@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
19 lines (18 loc) • 554 B
TypeScript
/**
* Normalize an array of object like the following :
*
* In this example, key = 'id'
* [{id:"x", other: "some value"},{id:"y", other: "some value"}]
*
* TO
*
* {
* x: {id:"x", other: "some value"}
* y: {id:"y", other: "some value"}
* }
* @param {*} arr input array of object to convert
* @param {*} key object key to extract
*/
import { Index } from './index';
export declare const normalizeArray: <T, K extends keyof T>(arr: Array<T>, key: K) => Index<T>;
export declare const denormalize: <T>(index: Index<T>) => Array<[string, T]>;