True if the provided value is a List
const { List } = require('immutable');
List.isList([]); // false
List.isList(List()); // true
Creates a new List containing values
.
const { List } = require('immutable');
List.of(1, 2, 3, 4)
// List [ 1, 2, 3, 4 ]
Note: Values are not altered or converted in any way.
const { List } = require('immutable');
List.of({x:1}, 2, [3], 4)
// List [ { x: 1 }, 2, [ 3 ], 4 ]
Generated using TypeDoc
Lists are ordered indexed dense collections, much like a JavaScript Array.
Lists are immutable and fully persistent with O(log32 N) gets and sets, and O(1) push and pop.
Lists implement Deque, with efficient addition and removal from both the end (
push
,pop
) and beginning (unshift
,shift
).Unlike a JavaScript Array, there is no distinction between an "unset" index and an index set to
undefined
.List#forEach
visits all indices from 0 to size, regardless of whether they were explicitly defined.