UNPKG

@mediarithmics/plugins-nodejs-sdk

Version:

This is the mediarithmics nodejs to help plugin developers bootstrapping their plugin without having to deal with most of the plugin boilerplate

21 lines 664 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.denormalize = exports.normalizeArray = void 0; const normalizeArray = (arr, key) => { if (!Array.isArray(arr)) { throw new Error(`${JSON.stringify(arr)} is not an array`); } return arr.reduce((acc, object) => { const keyValue = String(object[key]); return { ...acc, [keyValue]: object, }; }, {}); }; exports.normalizeArray = normalizeArray; const denormalize = (index) => { return Object.keys(index).map((k) => [k, index[k]]); }; exports.denormalize = denormalize; //# sourceMappingURL=Normalizer.js.map