UNPKG

flexifyparams

Version:

a helper utility for getting the parameter values if they're supposed to be be functions or other type of values

15 lines (14 loc) 558 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const lodash_1 = __importDefault(require("lodash")); function flexifyParams(param, args = []) { const composedObject = {}; for (const [key, value] of Object.entries(param)) { composedObject[key] = lodash_1.default.isFunction(value) ? value(...args) : value; } return composedObject; } exports.default = flexifyParams;