UNPKG

@magicbell/core

Version:

Official MagicBell API wrapper

23 lines 754 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = camelize; const tslib_1 = require("tslib"); const humps_1 = tslib_1.__importDefault(require("humps")); /** * Decorator factory to camelize the keys of the arguments passed to the * function decorated with this. * * @example * @camelize() * set(json = {}) { Object.assign(this, json) } */ function camelize() { return function (target, propertyKey, descriptor) { const originalMethod = descriptor.value; descriptor.value = function (...args) { const camelizedArgs = humps_1.default.camelizeKeys(args); return originalMethod.apply(this, camelizedArgs); }; }; } //# sourceMappingURL=camelize.js.map