Skip to main content

Home > @jsplumb/util > addToList

addToList() function#

Add an item to a list that is stored inside some map. This method is used internally.

Signature:

export declare function addToList<T>(map: Map<string, Array<T>>, key: string, value: any, insertAtStart?: boolean): Array<any>;

Parameters#

ParameterTypeDescription
mapMap<string, Array<T>>A map of <string, Array> entries.
keystringThe ID of the list to search for in the map
valueanyThe value to add to the list, if found
insertAtStartbooleanIf true, inserts the new item at the head of the list. Defaults to false.

Returns:

Array<any>