Adds new elements listed in the array parameter to the array in the store
under the key. If the array does not exist yet, it will be created.
a Map instance which contains or should contain the target
array.
a key to access the target array.
an array with new elements to add to the target array.
const store = new Map<string, string[]>();
setArray(store, 'foo', ['bar']);
store.get('foo'); // ['bar']
setArray(store, 'foo', ['baz']);
store.get('foo'); // ['bar', 'baz']
a WeakMap instance.
Adds new properties listed in the object parameter to the object in the
store under the key. If the object does not exist yet, it will be
created.
a Map instance which contains or should contain the target object.
a key to access the target object.
an object with new properties to add to the target object.
a WeakMap instance.
Generated using TypeDoc
This module provides tools to change complex values (like objects and arrays) in the
MaporWeakMapstore without explicit check for their existence. If the value does not exist, it will be created.Usage
import {setArray, setObject} from '@corpuscule/utils/lib/setters'