UNPKG

@connectv/core

Version:

agent-based reactive programming library for typescript/javascript

80 lines (79 loc) 1.32 kB
export declare type KeyFunc = (obj: any) => string | number; export declare type KeyMap = { [key: string]: { item: any; index: string; }; }; export declare type AdditionList = { /** * * The index that the item was added on. * */ index: string; /** * * The added item * */ item: any; }[]; export declare type DeletionList = { /** * * The index the deleted item used to be on * */ index: string; /** * * The deleted item * */ item: any; }[]; export declare type MoveList = { /** * * The index the item used to be on * */ oldIndex: string; /** * * The new index of the item * */ newIndex: string; /** * * The moved item * */ item: any; }[]; export declare type ChangeMap = { /** * * List of items added to the list * */ additions: AdditionList; /** * * List of items removed from the list * */ deletions: DeletionList; /** * * List of items moved around in the list * */ moves: MoveList; }; export declare function diff(value: any, oldKeyMap: KeyMap, keyfunc: KeyFunc): { changes: ChangeMap; newKeyMap: KeyMap; };