Immutable persistent vector for the browser and node.js
$ npm install @nathanfaucett/immutable-vector --save
$ yarn add @nathanfaucett/immutable-vector --save
var ImmutableVector = require("@nathanfaucett/immutable-vector");
var a = new ImmutableVector([0, 1, 2]),
b = new ImmutableVector(0, 1, 2),
c = ImmutableVector.of([0, 1, 2]),
d = ImmutableVector.of(0, 1, 2);
var a0 = a.push(3),
a1 = a.unshift(-1);
returns size of Vector, only available if Object.defineProperty is supported
returns true if value is a vector else false
creates Vector from passed values same as new Vector(...values: Array<Any>)
compares vectors by values
returns size of Vector
returns value at index
alias to get
returns first element
returns last element
returns index of value, -1 if not found
returns new Vector if value at index is different
returns new Vector with inserted values at index
returns new Vector without the values from index to index + count
returns new Vector with values pushed to end of the Vector
returns new Vector with values pushed to front of the Vector
returns new Vector without last element
returns new Vector without first element
returns new Vector with values pushed to end of the Vector
returns new Vector with values from vectors pushed to end of the Vector
returns Iterator
common Array methods
returns Vector elements in an Array
join all elements of an Vector into a String
String representation of Vector
compares this vector to other vector by values