angular2
Version:
Angular 2 - a web framework for modern web apps
15 lines • 694 B
JavaScript
import { isString } from 'angular2/src/facade/lang';
import { RequestMethods } from './enums';
import { makeTypeError } from 'angular2/src/facade/exceptions';
export function normalizeMethodName(method) {
if (isString(method)) {
var originalMethod = method;
method = method.replace(/(\w)(\w*)/g, (g0, g1, g2) => g1.toUpperCase() + g2.toLowerCase());
method = RequestMethods[method];
if (typeof method !== 'number')
throw makeTypeError(`Invalid request method. The method "${originalMethod}" is not supported.`);
}
return method;
}
export { isJsObject } from 'angular2/src/facade/lang';
//# sourceMappingURL=http_utils.js.map