Resolve "Transition to ESLint"

This commit is contained in:
Thea Schöbl
2022-06-27 14:40:09 +00:00
committed by Rainer Killinger
parent ca1d2444e0
commit 418ba67d15
47 changed files with 1854 additions and 1634 deletions

View File

@@ -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);
}