mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 09:03:02 +00:00
Resolve "Transition to ESLint"
This commit is contained in:
committed by
Rainer Killinger
parent
ca1d2444e0
commit
418ba67d15
@@ -14,10 +14,31 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// the list provides option to easily implement "isHttpMethod" guard
|
||||
const httpVerbs = ['get', 'post', 'put', 'delete', 'patch', 'options',
|
||||
'head', 'checkout', 'copy', 'lock', 'merge', 'mkactivity', 'mkcol',
|
||||
'move', 'm-search', 'notify', 'purge', 'report', 'search', 'subscribe',
|
||||
'trace', 'unlock','unsubscribe'] as const;
|
||||
const httpVerbs = [
|
||||
'get',
|
||||
'post',
|
||||
'put',
|
||||
'delete',
|
||||
'patch',
|
||||
'options',
|
||||
'head',
|
||||
'checkout',
|
||||
'copy',
|
||||
'lock',
|
||||
'merge',
|
||||
'mkactivity',
|
||||
'mkcol',
|
||||
'move',
|
||||
'm-search',
|
||||
'notify',
|
||||
'purge',
|
||||
'report',
|
||||
'search',
|
||||
'subscribe',
|
||||
'trace',
|
||||
'unlock',
|
||||
'unsubscribe',
|
||||
] as const;
|
||||
/**
|
||||
* Strings that can be used as HTTP verbs (e.g. in requests): 'get' | 'post' | 'put' | 'delete' etc.
|
||||
*/
|
||||
@@ -29,5 +50,5 @@ export type HTTPVerb = typeof httpVerbs[number];
|
||||
* @param method A text (representing a method) to check
|
||||
*/
|
||||
export function isHttpMethod(method: string): method is HTTPVerb {
|
||||
return (httpVerbs as unknown as string[]).indexOf(method) > -1;
|
||||
return (httpVerbs as unknown as string[]).includes(method);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user