withArrayItems()function
withArrayItems(list: PossibleArray<T>, ...add: T[]): ImmutableArray<T>
| Param | Type | |
|---|---|---|
list | PossibleArray<T> | The array or iterable to add to. required |
add | T[] | 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]