@plurid/plurid-functions
Version:
General Utility Functions for Plurid Applications
16 lines (15 loc) • 614 B
TypeScript
import { Indexed } from "../../data/interfaces";
/**
* Identify `items` by an `idEntity` property.
*
* @param items
* @param idEntity
*/
export declare const identify: <T>(items: T[], idEntity?: string) => (T & {
[x: string]: string;
})[];
export declare type MapType = 'map';
export declare type ObjectType = 'object';
export declare type CreateType = MapType | ObjectType;
export declare function create<T, O extends ObjectType>(items: T[], type?: O, idKey?: string): Indexed<T>;
export declare function create<T, M extends MapType>(items: T[], type?: M, idKey?: string): Map<string, T>;