withArrayItems()function

withArrayItems(list: PossibleArray<T>, ...add: T[]): ImmutableArray<T>
ParamType
listPossibleArray<T>
The array or iterable to add to. required
addT[]
The items to add (items already present are skipped). required
Return
ImmutableArray<T>
A new array including the added items, or the same array if nothing changed.

Add multiple items to an array (immutably) and return a new array with those items (or the same array if no changes were made).

Examples

withArrayItems([1, 2], 2, 3); // [1, 2, 3]