@magicbell/core
Version:
Official MagicBell API wrapper
19 lines • 588 B
JavaScript
import humps from '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) }
*/
export default function camelize() {
return function (target, propertyKey, descriptor) {
const originalMethod = descriptor.value;
descriptor.value = function (...args) {
const camelizedArgs = humps.camelizeKeys(args);
return originalMethod.apply(this, camelizedArgs);
};
};
}
//# sourceMappingURL=camelize.js.map