@affinidi/tools-openapi
Version:
SDK core monorepo for affinity DID solution
25 lines • 1.17 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapFunctions = void 0;
const lodash_mapvalues_1 = __importDefault(require("lodash.mapvalues"));
const mapFunctions = (obj, inputMapper) => (0, lodash_mapvalues_1.default)(obj, (value, key) => {
const mappedInput = inputMapper(value, key);
// we could simply return a function here, but then it would not have a display name
// and wouldn't show up in stacktraces properly,
// so we have to make a temporary object here in order for function to get a display name
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#inferred_function_names
const functionObject = {
[key]: async function (...args) {
const promise = mappedInput(this, ...args);
const result = await promise;
return result;
},
};
const f = functionObject[key];
return f;
});
exports.mapFunctions = mapFunctions;
//# sourceMappingURL=mapFunctions.js.map