window.data = JSON.parse("{\"Immutable\":{\"doc\":{\"synopsis\":\"
Immutable data encourages pure functions (data-in, data-out) and lends itself\\nto much simpler application development and enabling techniques from\\nfunctional programming such as lazy evaluation.
\\n\",\"description\":\"While designed to bring these powerful functional concepts to JavaScript, it\\npresents an Object-Oriented API familiar to Javascript engineers and closely\\nmirroring that of Array, Map, and Set. It is easy and efficient to convert to\\nand from plain Javascript types.
\\nIn order to better explain what kinds of values the Immutable.js API expects\\nand produces, this documentation is presented in a statically typed dialect of\\nJavaScript (like Flow or TypeScript). You don't need to use these\\ntype checking tools in order to use Immutable.js, however becoming familiar\\nwith their syntax will help you get a deeper understanding of this API.
\\nA few examples and how to read them.
\\nAll methods describe the kinds of data they accept and the kinds of data\\nthey return. For example a function which accepts two numbers and returns\\na number would look like this:
\\nsum(first: number, second: number): number
Sometimes, methods can accept different kinds of data or return different\\nkinds of data, and this is described with a type variable, which is\\ntypically in all-caps. For example, a function which always returns the same\\nkind of data it was provided would look like this:
\\nidentity<T>(value: T): T
Type variables are defined with classes and referred to in methods. For\\nexample, a class that holds onto a value for you might look like this:
\\nclass Box<T> {\\n constructor(value: T)\\n getValue(): T\\n}
In order to manipulate Immutable data, methods that we're used to affecting\\na Collection instead return a new Collection of the same type. The type\\nthis
refers to the same kind of class. For example, a List which returns\\nnew Lists when you push
a value onto it might look like:
class List<T> {\\n push(value: T): this\\n}
Many methods in Immutable.js accept values which implement the JavaScript\\nIterable protocol, and might appear like Iterable<string>
for something\\nwhich represents sequence of strings. Typically in JavaScript we use plain\\nArrays ([]
) when an Iterable is expected, but also all of the Immutable.js\\ncollections are iterable themselves!
For example, to get a value deep within a structure of data, we might use\\ngetIn
which expects an Iterable
path:
getIn(path: Iterable<string | number>): any
To use this method, we could pass an array: data.getIn([ \\\"key\\\", 2 ])
.
Note: All examples are presented in the modern ES2015 version of\\nJavaScript. Use tools like Babel to support older browsers.
\\nFor example:
\\n// ES2015\\nconst mappedFoo = foo.map(x => x * x);\\n// ES5\\nvar mappedFoo = foo.map(function (x) { return x * x; });
\",\"notes\":[]},\"module\":{\"List\":{\"doc\":{\"synopsis\":\"Lists are ordered indexed dense collections, much like a JavaScript\\nArray.
\\n\",\"description\":\"Lists are immutable and fully persistent with O(log32 N) gets and sets,\\nand O(1) push and pop.
\\nLists implement Deque, with efficient addition and removal from both the\\nend (push
, pop
) and beginning (unshift
, shift
).
Unlike a JavaScript Array, there is no distinction between an\\n"unset" index and an index set to undefined
. List#forEach
visits all\\nindices from 0 to size, regardless of whether they were explicitly defined.
True if the provided value is a List
\\n\",\"description\":\"\\nconst { List } = require('immutable');\\nList.isList([]); // false\\nList.isList(List()); // truerun it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeList\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":127}]}},\"of\":{\"call\":{\"doc\":{\"synopsis\":\"Creates a new List containing values
.
const { List } = require('immutable');\\nList.of(1, 2, 3, 4)\\n// List [ 1, 2, 3, 4 ]run it
Note: Values are not altered or converted in any way.
\\n\\nconst { List } = require('immutable');\\nList.of({x:1}, 2, [3], 4)\\n// List [ { x: 1 }, 2, [ 3 ], 4 ]run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"T\"],\"params\":[{\"name\":\"values\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":148}]}}},\"call\":{\"doc\":{\"synopsis\":\"Create a new immutable List containing the values of the provided\\ncollection-like.
\\n\",\"description\":\"Note: List
is a factory function and not a class, and does not use the\\nnew
keyword during construction.
const { List, Set } = require('immutable')\\n\\nconst emptyList = List()\\n// List []\\n\\nconst plainArray = [ 1, 2, 3, 4 ]\\nconst listFromPlainArray = List(plainArray)\\n// List [ 1, 2, 3, 4 ]\\n\\nconst plainSet = Set([ 1, 2, 3, 4 ])\\nconst listFromPlainSet = List(plainSet)\\n// List [ 1, 2, 3, 4 ]\\n\\nconst arrayIterator = plainArray[Symbol.iterator]()\\nconst listFromCollectionArray = List(arrayIterator)\\n// List [ 1, 2, 3, 4 ]\\n\\nlistFromPlainArray.equals(listFromCollectionArray) // true\\nlistFromPlainSet.equals(listFromCollectionArray) // true\\nlistFromPlainSet.equals(listFromPlainArray) // truerun it
\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":0}]},\"line\":182},{\"typeParams\":[\"T\"],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":183},{\"typeParams\":[\"T\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":8,\"param\":\"T\"}]}}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":184}]},\"interface\":{\"line\":186,\"typeParams\":[\"T\"],\"extends\":[{\"k\":9,\"name\":\"Collection.Indexed\",\"args\":[{\"k\":8,\"param\":\"T\"}]}],\"groups\":[{\"members\":{\"#size\":{\"line\":191}}},{\"title\":\"Persistent changes\",\"members\":{\"#set\":{\"doc\":{\"synopsis\":\"Returns a new List which includes value
at index
. If index
already\\nexists in this List, it will be replaced.
index
may be a negative number, which indexes back from the end of the\\nList. v.set(-1, \\\"value\\\")
sets the last item in the List.
If index
larger than size
, the returned List's size
will be large\\nenough to include the index
.
const originalList = List([ 0 ]);\\n// List [ 0 ]\\noriginalList.set(1, 1);\\n// List [ 0, 1 ]\\noriginalList.set(0, 'overwritten');\\n// List [ \\\"overwritten\\\" ]\\noriginalList.set(2, 2);\\n// List [ 0, undefined, 2 ]\\n\\nList().set(50000, 'value').size;\\n// 50001run it
Note: set
can be used in withMutations
.
Returns a new List which excludes this index
and with a size 1 less\\nthan this List. Values at indices above index
are shifted down by 1 to\\nfill the position.
This is synonymous with list.splice(index, 1)
.
index
may be a negative number, which indexes back from the end of the\\nList. v.delete(-1)
deletes the last item in the List.
Note: delete
cannot be safely used in IE8
List([ 0, 1, 2, 3, 4 ]).delete(0);\\n// List [ 1, 2, 3, 4 ]run it
Since delete()
re-indexes values, it produces a complete copy, which\\nhas O(N)
complexity.
Note: delete
cannot be used in withMutations
.
Returns a new List with value
at index
with a size 1 more than this\\nList. Values at indices above index
are shifted over by 1.
This is synonymous with list.splice(index, 0, value)
.
List([ 0, 1, 2, 3, 4 ]).insert(6, 5)\\n// List [ 0, 1, 2, 3, 4, 5 ]run it
Since insert()
re-indexes values, it produces a complete copy, which\\nhas O(N)
complexity.
Note: insert
cannot be used in withMutations
.
Returns a new List with 0 size and no values in constant time.
\\n\",\"description\":\"\\nList([ 1, 2, 3, 4 ]).clear()\\n// List []run it
Note: clear
can be used in withMutations
.
Returns a new List with the provided values
appended, starting at this\\nList's size
.
List([ 1, 2, 3, 4 ]).push(5)\\n// List [ 1, 2, 3, 4, 5 ]run it
Note: push
can be used in withMutations
.
Returns a new List with a size ones less than this List, excluding\\nthe last index in this List.
\\n\",\"description\":\"Note: this differs from Array#pop
because it returns a new\\nList rather than the removed value. Use last()
to get the last value\\nin this List.
List([ 1, 2, 3, 4 ]).pop()\\n// List[ 1, 2, 3 ]
Note: pop
can be used in withMutations
.
Returns a new List with the provided values
prepended, shifting other\\nvalues ahead to higher indices.
List([ 2, 3, 4]).unshift(1);\\n// List [ 1, 2, 3, 4 ]run it
Note: unshift
can be used in withMutations
.
Returns a new List with a size ones less than this List, excluding\\nthe first index in this List, shifting all other values to a lower index.
\\n\",\"description\":\"Note: this differs from Array#shift
because it returns a new\\nList rather than the removed value. Use first()
to get the first\\nvalue in this List.
List([ 0, 1, 2, 3, 4 ]).shift();\\n// List [ 1, 2, 3, 4 ]run it
Note: shift
can be used in withMutations
.
Returns a new List with an updated value at index
with the return\\nvalue of calling updater
with the existing value, or notSetValue
if\\nindex
was not set. If called with a single argument, updater
is\\ncalled with the List itself.
index
may be a negative number, which indexes back from the end of the\\nList. v.update(-1)
updates the last item in the List.
const list = List([ 'a', 'b', 'c' ])\\nconst result = list.update(2, val => val.toUpperCase())\\n// List [ \\\"a\\\", \\\"b\\\", \\\"C\\\" ]run it
This can be very useful as a way to "chain" a normal function into a\\nsequence of methods. RxJS calls this "let" and lodash calls it "thru".
\\nFor example, to sum a List after mapping and filtering:
\\n\\nfunction sum(collection) {\\n return collection.reduce((sum, x) => sum + x, 0)\\n}\\n\\nList([ 1, 2, 3 ])\\n .map(x => x + 1)\\n .filter(x => x % 2 === 0)\\n .update(sum)\\n// 6run it
Note: update(index)
can be used in withMutations
.
Map#update
Returns a new List with size size
. If size
is less than this\\nList's size, the new List will exclude values at the higher indices.\\nIf size
is greater than this List's size, the new List will have\\nundefined values for the newly available indices.
When building a new List and the final size is known up front, setSize
\\nused in conjunction with withMutations
may result in the more\\nperformant construction.
Returns a new List having set value
at this keyPath
. If any keys in\\nkeyPath
do not exist, a new immutable Map will be created at that key.
Index numbers are used as keys to determine the path to follow in\\nthe List.
\\n\\nconst { List } = require('immutable')\\nconst list = List([ 0, 1, 2, List([ 3, 4 ])])\\nlist.setIn([3, 0], 999);\\n// List [ 0, 1, 2, List [ 999, 4 ] ]run it
Plain JavaScript Object or Arrays may be nested within an Immutable.js\\nCollection, and setIn() can update those values as well, treating them\\nimmutably by creating new copies of those values with the changes applied.
\\n\\nconst { List } = require('immutable')\\nconst list = List([ 0, 1, 2, { plain: 'object' }])\\nlist.setIn([3, 'plain'], 'value');\\n// List([ 0, 1, 2, { plain: 'value' }])run it
Note: setIn
can be used in withMutations
.
Returns a new List having removed the value at this keyPath
. If any\\nkeys in keyPath
do not exist, no change will occur.
const { List } = require('immutable')\\nconst list = List([ 0, 1, 2, List([ 3, 4 ])])\\nlist.deleteIn([3, 0]);\\n// List [ 0, 1, 2, List [ 4 ] ]run it
Plain JavaScript Object or Arrays may be nested within an Immutable.js\\nCollection, and removeIn() can update those values as well, treating them\\nimmutably by creating new copies of those values with the changes applied.
\\n\\nconst { List } = require('immutable')\\nconst list = List([ 0, 1, 2, { plain: 'object' }])\\nlist.removeIn([3, 'plain']);\\n// List([ 0, 1, 2, {}])run it
Note: deleteIn
cannot be safely used in withMutations
.
Note: updateIn
can be used in withMutations
.
Map#updateIn
Note: mergeIn
can be used in withMutations
.
Map#mergeIn
Note: mergeDeepIn
can be used in withMutations
.
Map#mergeDeepIn
Note: Not all methods can be safely used on a mutable collection or within\\nwithMutations
! Check the documentation for each method to see if it\\nallows being used in withMutations
.
Map#withMutations
An alternative API for withMutations()
\\n\",\"description\":\"Note: Not all methods can be safely used on a mutable collection or within\\nwithMutations
! Check the documentation for each method to see if it\\nallows being used in withMutations
.
Map#asMutable
Map#wasAltered
Map#asImmutable
Returns a new List with other values or collections concatenated to this one.
\\n\",\"description\":\"Note: concat
can be used in withMutations
.
Returns a new List with values passed through a\\nmapper
function.
List([ 1, 2 ]).map(x => 10 * x)\\n// List [ 10, 20 ]run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"M\"],\"params\":[{\"name\":\"mapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"key\",\"type\":{\"k\":2}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"M\"}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":8,\"param\":\"M\"}]},\"line\":562}]},\"#flatMap\":{\"doc\":{\"synopsis\":\"Flat-maps the List, returning a new List.
\\n\",\"description\":\"Similar to list.map(...).flatten(true)
.
Returns a new List with only the values for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Returns a List "zipped" with the provided collection.
\\n\",\"description\":\"Like zipWith
, but using the default zipper
: creating an Array
.
const a = List([ 1, 2, 3 ]);\\nconst b = List([ 4, 5, 6 ]);\\nconst c = a.zip(b); // List [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":607},{\"typeParams\":[\"U\",\"V\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"other2\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":608},{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":0}]},\"line\":609}]},\"#zipAll\":{\"doc\":{\"synopsis\":\"Returns a List "zipped" with the provided collections.
\\n\",\"description\":\"Unlike zip
, zipAll
continues zipping until the longest collection is\\nexhausted. Missing values from shorter collections are filled with undefined
.
const a = List([ 1, 2 ]);\\nconst b = List([ 3, 4, 5 ]);\\nconst c = a.zipAll(b); // List [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ]run it
Note: Since zipAll will return a collection as large as the largest\\ninput, some results may contain undefined values. TypeScript cannot\\naccount for these without cases (as of v2.5).
\\n\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":630},{\"typeParams\":[\"U\",\"V\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"other2\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":631},{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":0}]},\"line\":632}]},\"#zipWith\":{\"doc\":{\"synopsis\":\"Returns a List "zipped" with the provided collections by using a\\ncustom zipper
function.
const a = List([ 1, 2, 3 ]);\\nconst b = List([ 4, 5, 6 ]);\\nconst c = a.zipWith((a, b) => a + b, b);\\n// List [ 5, 7, 9 ]run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\",\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"otherValue\",\"type\":{\"k\":8,\"param\":\"U\"}}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"otherCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":648},{\"typeParams\":[\"U\",\"V\",\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"otherValue\",\"type\":{\"k\":8,\"param\":\"U\"}},{\"name\":\"thirdValue\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"otherCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"thirdCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":652},{\"typeParams\":[\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"any\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"varArgs\":true}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":657}]}}}]}},\"Map\":{\"doc\":{\"synopsis\":\"Immutable Map is an unordered Collection.Keyed of (key, value) pairs with\\nO(log32 N)
gets and O(log32 N)
persistent sets.
Iteration order of a Map is undefined, however is stable. Multiple\\niterations of the same Map will iterate in the same order.
\\nMap's keys can be of any type, and use Immutable.is
to determine key\\nequality. This allows the use of any value (including NaN) as a key.
Because Immutable.is
returns equality based on value semantics, and\\nImmutable collections are treated as values, any Immutable collection may\\nbe used as a key.
const { Map, List } = require('immutable');\\nMap().set(List([ 1 ]), 'listofone').get(List([ 1 ]));\\n// 'listofone'run it
Any JavaScript object may be used as a key, however strict identity is used\\nto evaluate key equality. Two similar looking objects will represent two\\ndifferent keys.
\\nImplemented by a hash-array mapped trie.
\\n\",\"notes\":[]},\"module\":{\"isMap\":{\"call\":{\"doc\":{\"synopsis\":\"True if the provided value is a Map
\\n\",\"description\":\"\\nconst { Map } = require('immutable')\\nMap.isMap({}) // false\\nMap.isMap(Map()) // truerun it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeMap\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":703}]}}},\"call\":{\"doc\":{\"synopsis\":\"Creates a new Immutable Map.
\\n\",\"description\":\"Created with the same key value pairs as the provided Collection.Keyed or\\nJavaScript Object or expects a Collection of [K, V] tuple entries.
\\nNote: Map
is a factory function and not a class, and does not use the\\nnew
keyword during construction.
const { Map } = require('immutable')\\nMap({ key: \\\"value\\\" })\\nMap([ [ \\\"key\\\", \\\"value\\\" ] ])run it
Keep in mind, when using JS objects to construct Immutable Maps, that\\nJavaScript Object properties are always strings, even if written in a\\nquote-less shorthand, while Immutable Maps accept keys of any type.
\\n\\nlet obj = { 1: \\\"one\\\" }\\nObject.keys(obj) // [ \\\"1\\\" ]\\nassert.equal(obj[\\\"1\\\"], obj[1]) // \\\"one\\\" === \\\"one\\\"\\n\\nlet map = Map(obj)\\nassert.notEqual(map.get(\\\"1\\\"), map.get(1)) // \\\"one\\\" !== undefinedrun it
Property access for JavaScript Objects first converts the key to a string,\\nbut since Immutable Map keys can be of any type the argument to get()
is\\nnot altered.
Returns a new Map also containing the new key, value pair. If an equivalent\\nkey already exists in this Map, it will be replaced.
\\n\",\"description\":\"\\nconst { Map } = require('immutable')\\nconst originalMap = Map()\\nconst newerMap = originalMap.set('key', 'value')\\nconst newestMap = newerMap.set('key', 'newer value')\\n\\noriginalMap\\n// Map {}\\nnewerMap\\n// Map { \\\"key\\\": \\\"value\\\" }\\nnewestMap\\n// Map { \\\"key\\\": \\\"newer value\\\" }run it
Note: set
can be used in withMutations
.
Returns a new Map which excludes this key
.
Note: delete
cannot be safely used in IE8, but is provided to mirror\\nthe ES6 collection API.
const { Map } = require('immutable')\\nconst originalMap = Map({\\n key: 'value',\\n otherKey: 'other value'\\n})\\n// Map { \\\"key\\\": \\\"value\\\", \\\"otherKey\\\": \\\"other value\\\" }\\noriginalMap.delete('otherKey')\\n// Map { \\\"key\\\": \\\"value\\\" }run it
Note: delete
can be used in withMutations
.
Returns a new Map which excludes the provided keys
.
const { Map } = require('immutable')\\nconst names = Map({ a: \\\"Aaron\\\", b: \\\"Barry\\\", c: \\\"Connor\\\" })\\nnames.deleteAll([ 'a', 'c' ])\\n// Map { \\\"b\\\": \\\"Barry\\\" }run it
Note: deleteAll
can be used in withMutations
.
Returns a new Map containing no keys or values.
\\n\",\"description\":\"\\nconst { Map } = require('immutable')\\nMap({ key: 'value' }).clear()\\n// Map {}run it
Note: clear
can be used in withMutations
.
Returns a new Map having updated the value at this key
with the return\\nvalue of calling updater
with the existing value.
Similar to: map.set(key, updater(map.get(key)))
.
const { Map } = require('immutable')\\nconst aMap = Map({ key: 'value' })\\nconst newMap = aMap.update('key', value => value + value)\\n// Map { \\\"key\\\": \\\"valuevalue\\\" }run it
This is most commonly used to call methods on collections within a\\nstructure of data. For example, in order to .push()
onto a nested List
,\\nupdate
and push
can be used together:
const aMap = Map({ nestedList: List([ 1, 2, 3 ]) })\\nconst newMap = aMap.update('nestedList', list => list.push(4))\\n// Map { \\\"nestedList\\\": List [ 1, 2, 3, 4 ] }run it
When a notSetValue
is provided, it is provided to the updater
\\nfunction when the value at the key does not exist in the Map.
const aMap = Map({ key: 'value' })\\nconst newMap = aMap.update('noKey', 'no value', value => value + value)\\n// Map { \\\"key\\\": \\\"value\\\", \\\"noKey\\\": \\\"no valueno value\\\" }run it
However, if the updater
function returns the same value it was called\\nwith, then no change will occur. This is still true if notSetValue
\\nis provided.
const aMap = Map({ apples: 10 })\\nconst newMap = aMap.update('oranges', 0, val => val)\\n// Map { \\\"apples\\\": 10 }\\nassert.strictEqual(newMap, map);run it
For code using ES2015 or later, using notSetValue
is discourged in\\nfavor of function parameter default values. This helps to avoid any\\npotential confusion with identify functions as described above.
The previous example behaves differently when written with default values:
\\n\\nconst aMap = Map({ apples: 10 })\\nconst newMap = aMap.update('oranges', (val = 0) => val)\\n// Map { \\\"apples\\\": 10, \\\"oranges\\\": 0 }run it
If no key is provided, then the updater
function return value is\\nreturned as well.
const aMap = Map({ key: 'value' })\\nconst result = aMap.update(aMap => aMap.get('key'))\\n// \\\"value\\\"run it
This can be very useful as a way to "chain" a normal function into a\\nsequence of methods. RxJS calls this "let" and lodash calls it "thru".
\\nFor example, to sum the values in a Map
\\n\\nfunction sum(collection) {\\n return collection.reduce((sum, x) => sum + x, 0)\\n}\\n\\nMap({ x: 1, y: 2, z: 3 })\\n .map(x => x + 1)\\n .filter(x => x % 2 === 0)\\n .update(sum)\\n// 6run it
Note: update(key)
can be used in withMutations
.
Returns a new Map resulting from merging the provided Collections\\n(or JS objects) into this Map. In other words, this takes each entry of\\neach collection and sets it on this Map.
\\n\",\"description\":\"Note: Values provided to merge
are shallowly converted before being\\nmerged. No nested values are altered.
const { Map } = require('immutable')\\nconst one = Map({ a: 10, b: 20, c: 30 })\\nconst two = Map({ b: 40, a: 50, d: 60 })\\none.merge(two) // Map { \\\"a\\\": 50, \\\"b\\\": 40, \\\"c\\\": 30, \\\"d\\\": 60 }\\ntwo.merge(one) // Map { \\\"b\\\": 20, \\\"a\\\": 10, \\\"d\\\": 60, \\\"c\\\": 30 }run it
Note: merge
can be used in withMutations
.
Like merge()
, mergeWith()
returns a new Map resulting from merging\\nthe provided Collections (or JS objects) into this Map, but uses the\\nmerger
function for dealing with conflicts.
const { Map } = require('immutable')\\nconst one = Map({ a: 10, b: 20, c: 30 })\\nconst two = Map({ b: 40, a: 50, d: 60 })\\none.mergeWith((oldVal, newVal) => oldVal / newVal, two)\\n// { \\\"a\\\": 0.2, \\\"b\\\": 0.5, \\\"c\\\": 30, \\\"d\\\": 60 }\\ntwo.mergeWith((oldVal, newVal) => oldVal / newVal, one)\\n// { \\\"b\\\": 2, \\\"a\\\": 5, \\\"d\\\": 60, \\\"c\\\": 30 }run it
Note: mergeWith
can be used in withMutations
.
Like merge()
, but when two Collections conflict, it merges them as well,\\nrecursing deeply through the nested data.
Note: Values provided to merge
are shallowly converted before being\\nmerged. No nested values are altered unless they will also be merged at\\na deeper level.
const { Map } = require('immutable')\\nconst one = Map({ a: Map({ x: 10, y: 10 }), b: Map({ x: 20, y: 50 }) })\\nconst two = Map({ a: Map({ x: 2 }), b: Map({ y: 5 }), c: Map({ z: 3 }) })\\none.mergeDeep(two)\\n// Map {\\n// \\\"a\\\": Map { \\\"x\\\": 2, \\\"y\\\": 10 },\\n// \\\"b\\\": Map { \\\"x\\\": 20, \\\"y\\\": 5 },\\n// \\\"c\\\": Map { \\\"z\\\": 3 }\\n// }run it
Note: mergeDeep
can be used in withMutations
.
Like mergeDeep()
, but when two non-Collections conflict, it uses the\\nmerger
function to determine the resulting value.
const { Map } = require('immutable')\\nconst one = Map({ a: Map({ x: 10, y: 10 }), b: Map({ x: 20, y: 50 }) })\\nconst two = Map({ a: Map({ x: 2 }), b: Map({ y: 5 }), c: Map({ z: 3 }) })\\none.mergeDeepWith((oldVal, newVal) => oldVal / newVal, two)\\n// Map {\\n// \\\"a\\\": Map { \\\"x\\\": 5, \\\"y\\\": 10 },\\n// \\\"b\\\": Map { \\\"x\\\": 20, \\\"y\\\": 10 },\\n// \\\"c\\\": Map { \\\"z\\\": 3 }\\n// }run it
Note: mergeDeepWith
can be used in withMutations
.
Returns a new Map having set value
at this keyPath
. If any keys in\\nkeyPath
do not exist, a new immutable Map will be created at that key.
const { Map } = require('immutable')\\nconst originalMap = Map({\\n subObject: Map({\\n subKey: 'subvalue',\\n subSubObject: Map({\\n subSubKey: 'subSubValue'\\n })\\n })\\n})\\n\\nconst newMap = originalMap.setIn(['subObject', 'subKey'], 'ha ha!')\\n// Map {\\n// \\\"subObject\\\": Map {\\n// \\\"subKey\\\": \\\"ha ha!\\\",\\n// \\\"subSubObject\\\": Map { \\\"subSubKey\\\": \\\"subSubValue\\\" }\\n// }\\n// }\\n\\nconst newerMap = originalMap.setIn(\\n ['subObject', 'subSubObject', 'subSubKey'],\\n 'ha ha ha!'\\n)\\n// Map {\\n// \\\"subObject\\\": Map {\\n// \\\"subKey\\\": \\\"subvalue\\\",\\n// \\\"subSubObject\\\": Map { \\\"subSubKey\\\": \\\"ha ha ha!\\\" }\\n// }\\n// }run it
Plain JavaScript Object or Arrays may be nested within an Immutable.js\\nCollection, and setIn() can update those values as well, treating them\\nimmutably by creating new copies of those values with the changes applied.
\\n\\nconst { Map } = require('immutable')\\nconst originalMap = Map({\\n subObject: {\\n subKey: 'subvalue',\\n subSubObject: {\\n subSubKey: 'subSubValue'\\n }\\n }\\n})\\n\\noriginalMap.setIn(['subObject', 'subKey'], 'ha ha!')\\n// Map {\\n// \\\"subObject\\\": {\\n// subKey: \\\"ha ha!\\\",\\n// subSubObject: { subSubKey: \\\"subSubValue\\\" }\\n// }\\n// }run it
If any key in the path exists but cannot be updated (such as a primitive\\nlike number or a custom Object like Date), an error will be thrown.
\\nNote: setIn
can be used in withMutations
.
Returns a new Map having removed the value at this keyPath
. If any keys\\nin keyPath
do not exist, no change will occur.
Note: deleteIn
can be used in withMutations
.
Returns a new Map having applied the updater
to the entry found at the\\nkeyPath.
This is most commonly used to call methods on collections nested within a\\nstructure of data. For example, in order to .push()
onto a nested List
,\\nupdateIn
and push
can be used together:
const { Map, List } = require('immutable')\\nconst map = Map({ inMap: Map({ inList: List([ 1, 2, 3 ]) }) })\\nconst newMap = map.updateIn(['inMap', 'inList'], list => list.push(4))\\n// Map { \\\"inMap\\\": Map { \\\"inList\\\": List [ 1, 2, 3, 4 ] } }run it
If any keys in keyPath
do not exist, new Immutable Map
s will\\nbe created at those keys. If the keyPath
does not already contain a\\nvalue, the updater
function will be called with notSetValue
, if\\nprovided, otherwise undefined
.
const map = Map({ a: Map({ b: Map({ c: 10 }) }) })\\nconst newMap = map.updateIn(['a', 'b', 'c'], val => val * 2)\\n// Map { \\\"a\\\": Map { \\\"b\\\": Map { \\\"c\\\": 20 } } }run it
If the updater
function returns the same value it was called with, then\\nno change will occur. This is still true if notSetValue
is provided.
const map = Map({ a: Map({ b: Map({ c: 10 }) }) })\\nconst newMap = map.updateIn(['a', 'b', 'x'], 100, val => val)\\n// Map { \\\"a\\\": Map { \\\"b\\\": Map { \\\"c\\\": 10 } } }\\nassert.strictEqual(newMap, aMap)run it
For code using ES2015 or later, using notSetValue
is discourged in\\nfavor of function parameter default values. This helps to avoid any\\npotential confusion with identify functions as described above.
The previous example behaves differently when written with default values:
\\n\\nconst map = Map({ a: Map({ b: Map({ c: 10 }) }) })\\nconst newMap = map.updateIn(['a', 'b', 'x'], (val = 100) => val)\\n// Map { \\\"a\\\": Map { \\\"b\\\": Map { \\\"c\\\": 10, \\\"x\\\": 100 } } }run it
Plain JavaScript Object or Arrays may be nested within an Immutable.js\\nCollection, and updateIn() can update those values as well, treating them\\nimmutably by creating new copies of those values with the changes applied.
\\n\\nconst map = Map({ a: { b: { c: 10 } } })\\nconst newMap = map.updateIn(['a', 'b', 'c'], val => val * 2)\\n// Map { \\\"a\\\": { b: { c: 20 } } }run it
If any key in the path exists but cannot be updated (such as a primitive\\nlike number or a custom Object like Date), an error will be thrown.
\\nNote: updateIn
can be used in withMutations
.
A combination of updateIn
and merge
, returning a new Map, but\\nperforming the merge at a point arrived at by following the keyPath.\\nIn other words, these two lines are equivalent:
map.updateIn(['a', 'b', 'c'], abc => abc.merge(y))\\nmap.mergeIn(['a', 'b', 'c'], y)
Note: mergeIn
can be used in withMutations
.
A combination of updateIn
and mergeDeep
, returning a new Map, but\\nperforming the deep merge at a point arrived at by following the keyPath.\\nIn other words, these two lines are equivalent:
map.updateIn(['a', 'b', 'c'], abc => abc.mergeDeep(y))\\nmap.mergeDeepIn(['a', 'b', 'c'], y)
Note: mergeDeepIn
can be used in withMutations
.
Every time you call one of the above functions, a new immutable Map is\\ncreated. If a pure function calls a number of these to produce a final\\nreturn value, then a penalty on performance and memory has been paid by\\ncreating all of the intermediate immutable Maps.
\\n\",\"description\":\"If you need to apply a series of mutations to produce a new immutable\\nMap, withMutations()
creates a temporary mutable copy of the Map which\\ncan apply mutations in a highly performant manner. In fact, this is\\nexactly how complex mutations like merge
are done.
As an example, this results in the creation of 2, not 4, new Maps:
\\n\\nconst { Map } = require('immutable')\\nconst map1 = Map()\\nconst map2 = map1.withMutations(map => {\\n map.set('a', 1).set('b', 2).set('c', 3)\\n})\\nassert.equal(map1.size, 0)\\nassert.equal(map2.size, 3)run it
Note: Not all methods can be used on a mutable collection or within\\nwithMutations
! Read the documentation for each method to see if it\\nis safe to use in withMutations
.
Another way to avoid creation of intermediate Immutable maps is to create\\na mutable copy of this collection. Mutable copies always return this
,\\nand thus shouldn't be used for equality. Your function should never return\\na mutable copy of a collection, only use it internally to create a new\\ncollection.
If possible, use withMutations
to work with temporary mutable copies as\\nit provides an easier to use API and considers many common optimizations.
Note: if the collection is already mutable, asMutable
returns itself.
Note: Not all methods can be used on a mutable collection or within\\nwithMutations
! Read the documentation for each method to see if it\\nis safe to use in withMutations
.
Map#asImmutable
Returns true if this is a mutable copy (see asMutable()
) and mutative\\nalterations have been applied.
Map#asMutable
The yin to asMutable
's yang. Because it applies to mutable collections,\\nthis operation is mutable and may return itself (though may not\\nreturn itself, i.e. if the result is an empty collection). Once\\nperformed, the original mutable copy must no longer be mutated since it\\nmay be the immutable result.
If possible, use withMutations
to work with temporary mutable copies as\\nit provides an easier to use API and considers many common optimizations.
Map#asMutable
Returns a new Map with values passed through a\\nmapper
function.
Map({ a: 1, b: 2 }).map(x => 10 * x)\\n// Map { a: 10, b: 20 }
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"M\"],\"params\":[{\"name\":\"mapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"M\"}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"Map\",\"args\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"M\"}]},\"line\":1330}]},\"#mapKeys\":{\"doc\":{\"synopsis\":\"\",\"description\":\"\",\"notes\":[{\"name\":\"see\",\"body\":\"Collection.Keyed.mapKeys
\\n\"}]},\"signatures\":[{\"typeParams\":[\"M\"],\"params\":[{\"name\":\"mapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"M\"}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"Map\",\"args\":[{\"k\":8,\"param\":\"M\"},{\"k\":8,\"param\":\"V\"}]},\"line\":1338}]},\"#mapEntries\":{\"doc\":{\"synopsis\":\"\",\"description\":\"\",\"notes\":[{\"name\":\"see\",\"body\":\"Collection.Keyed.mapEntries
\\n\"}]},\"signatures\":[{\"typeParams\":[\"KM\",\"VM\"],\"params\":[{\"name\":\"mapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"entry\",\"type\":{\"k\":15,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]}},{\"name\":\"index\",\"type\":{\"k\":2}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":15,\"types\":[{\"k\":8,\"param\":\"KM\"},{\"k\":8,\"param\":\"VM\"}]}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"Map\",\"args\":[{\"k\":8,\"param\":\"KM\"},{\"k\":8,\"param\":\"VM\"}]},\"line\":1346}]},\"#flatMap\":{\"doc\":{\"synopsis\":\"Flat-maps the Map, returning a new Map.
\\n\",\"description\":\"Similar to data.map(...).flatten(true)
.
Returns a new Map with only the entries for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Collection.Keyed.flip
\\n\"}]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Map\",\"args\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"K\"}]},\"line\":1380}]}}}]}},\"OrderedMap\":{\"doc\":{\"synopsis\":\"A type of Map that has the additional guarantee that the iteration order of\\nentries will be the order in which they were set().
\\n\",\"description\":\"The iteration behavior of OrderedMap is the same as native ES6 Map and\\nJavaScript Object.
\\nNote that OrderedMap
are more expensive than non-ordered Map
and may\\nconsume more memory. OrderedMap#set
is amortized O(log32 N), but not\\nstable.
True if the provided value is an OrderedMap.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeOrderedMap\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":1401}]}}},\"call\":{\"doc\":{\"synopsis\":\"Creates a new Immutable OrderedMap.
\\n\",\"description\":\"Created with the same key value pairs as the provided Collection.Keyed or\\nJavaScript Object or expects a Collection of [K, V] tuple entries.
\\nThe iteration order of key-value pairs provided to this constructor will\\nbe preserved in the OrderedMap.
\\nlet newOrderedMap = OrderedMap({key: \\\"value\\\"})\\nlet newOrderedMap = OrderedMap([[\\\"key\\\", \\\"value\\\"]])
Note: OrderedMap
is a factory function and not a class, and does not use\\nthe new
keyword during construction.
Returns a new OrderedMap also containing the new key, value pair. If an\\nequivalent key already exists in this OrderedMap, it will be replaced\\nwhile maintaining the existing order.
\\n\",\"description\":\"\\nconst { OrderedMap } = require('immutable')\\nconst originalMap = OrderedMap({a:1, b:1, c:1})\\nconst updatedMap = originalMap.set('b', 2)\\n\\noriginalMap\\n// OrderedMap {a: 1, b: 1, c: 1}\\nupdatedMap\\n// OrderedMap {a: 1, b: 2, c: 1}run it
Note: set
can be used in withMutations
.
Returns a new OrderedMap resulting from merging the provided Collections\\n(or JS objects) into this OrderedMap. In other words, this takes each\\nentry of each collection and sets it on this OrderedMap.
\\n\",\"description\":\"Note: Values provided to merge
are shallowly converted before being\\nmerged. No nested values are altered.
const { OrderedMap } = require('immutable')\\nconst one = OrderedMap({ a: 10, b: 20, c: 30 })\\nconst two = OrderedMap({ b: 40, a: 50, d: 60 })\\none.merge(two) // OrderedMap { \\\"a\\\": 50, \\\"b\\\": 40, \\\"c\\\": 30, \\\"d\\\": 60 }\\ntwo.merge(one) // OrderedMap { \\\"b\\\": 20, \\\"a\\\": 10, \\\"d\\\": 60, \\\"c\\\": 30 }run it
Note: merge
can be used in withMutations
.
Returns a new OrderedMap with values passed through a\\nmapper
function.
OrderedMap({ a: 1, b: 2 }).map(x => 10 * x)\\n// OrderedMap { \\\"a\\\": 10, \\\"b\\\": 20 }
Note: map()
always returns a new instance, even if it produced the same\\nvalue at every step.
Collection.Keyed.mapKeys
\\n\"}]},\"signatures\":[{\"typeParams\":[\"M\"],\"params\":[{\"name\":\"mapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"M\"}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"OrderedMap\",\"args\":[{\"k\":8,\"param\":\"M\"},{\"k\":8,\"param\":\"V\"}]},\"line\":1498}]},\"#mapEntries\":{\"doc\":{\"synopsis\":\"\",\"description\":\"\",\"notes\":[{\"name\":\"see\",\"body\":\"Collection.Keyed.mapEntries
\\n\"}]},\"signatures\":[{\"typeParams\":[\"KM\",\"VM\"],\"params\":[{\"name\":\"mapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"entry\",\"type\":{\"k\":15,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]}},{\"name\":\"index\",\"type\":{\"k\":2}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":15,\"types\":[{\"k\":8,\"param\":\"KM\"},{\"k\":8,\"param\":\"VM\"}]}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"OrderedMap\",\"args\":[{\"k\":8,\"param\":\"KM\"},{\"k\":8,\"param\":\"VM\"}]},\"line\":1506}]},\"#flatMap\":{\"doc\":{\"synopsis\":\"Flat-maps the OrderedMap, returning a new OrderedMap.
\\n\",\"description\":\"Similar to data.map(...).flatten(true)
.
Returns a new OrderedMap with only the entries for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Collection.Keyed.flip
\\n\"}]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"OrderedMap\",\"args\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"K\"}]},\"line\":1540}]}}}]}},\"Set\":{\"doc\":{\"synopsis\":\"A Collection of unique values with O(log32 N)
adds and has.
When iterating a Set, the entries will be (value, value) pairs. Iteration\\norder of a Set is undefined, however is stable. Multiple iterations of the\\nsame Set will iterate in the same order.
\\nSet values, like Map keys, may be of any type. Equality is determined using\\nImmutable.is
, enabling Sets to uniquely include other Immutable\\ncollections, custom value types, and NaN.
True if the provided value is a Set
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeSet\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":1560}]}},\"of\":{\"call\":{\"doc\":{\"synopsis\":\"Creates a new Set containing values
.
Set.fromKeys()
creates a new immutable Set containing the keys from\\nthis Collection or JavaScript Object.
Set.intersect()
creates a new immutable Set that is the intersection of\\na collection of other sets.
const { Set } = require('immutable')\\nconst intersected = Set.intersect([\\n Set([ 'a', 'b', 'c' ])\\n Set([ 'c', 'a', 't' ])\\n])\\n// Set [ \\\"a\\\", \\\"c\\\"\\\" ]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"T\"],\"params\":[{\"name\":\"sets\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":8,\"param\":\"T\"}]}]}}],\"type\":{\"k\":9,\"name\":\"Set\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":1587}]}},\"union\":{\"call\":{\"doc\":{\"synopsis\":\"Set.union()
creates a new immutable Set that is the union of a\\ncollection of other sets.
const { Set } = require('immutable')\\nconst unioned = Set.union([\\n Set([ 'a', 'b', 'c' ])\\n Set([ 'c', 'a', 't' ])\\n])\\n// Set [ \\\"a\\\", \\\"b\\\", \\\"c\\\", \\\"t\\\"\\\" ]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"T\"],\"params\":[{\"name\":\"sets\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":8,\"param\":\"T\"}]}]}}],\"type\":{\"k\":9,\"name\":\"Set\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":1602}]}}},\"call\":{\"doc\":{\"synopsis\":\"Create a new immutable Set containing the values of the provided\\ncollection-like.
\\n\",\"description\":\"Note: Set
is a factory function and not a class, and does not use the\\nnew
keyword during construction.
Returns a new Set which also includes this value.
\\n\",\"description\":\"Note: add
can be used in withMutations
.
Returns a new Set which excludes this value.
\\n\",\"description\":\"Note: delete
can be used in withMutations
.
Note: delete
cannot be safely used in IE8, use remove
if\\nsupporting old browsers.
Returns a new Set containing no values.
\\n\",\"description\":\"Note: clear
can be used in withMutations
.
Returns a Set including any value from collections
that does not already\\nexist in this Set.
Note: union
can be used in withMutations
.
Returns a Set which has removed any values not also contained\\nwithin collections
.
Note: intersect
can be used in withMutations
.
Returns a Set excluding any values contained within collections
.
const { OrderedSet } = require('immutable')\\nOrderedSet([ 1, 2, 3 ]).subtract([1, 3])\\n// OrderedSet [2]run it
Note: subtract
can be used in withMutations
.
Note: Not all methods can be used on a mutable collection or within\\nwithMutations
! Check the documentation for each method to see if it\\nmentions being safe to use in withMutations
.
Map#withMutations
Note: Not all methods can be used on a mutable collection or within\\nwithMutations
! Check the documentation for each method to see if it\\nmentions being safe to use in withMutations
.
Map#asMutable
Map#wasAltered
Map#asImmutable
Returns a new Set with values passed through a\\nmapper
function.
Set([1,2]).map(x => 10 * x)\\n// Set [10,20]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"M\"],\"params\":[{\"name\":\"mapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"M\"}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"Set\",\"args\":[{\"k\":8,\"param\":\"M\"}]},\"line\":1726}]},\"#flatMap\":{\"doc\":{\"synopsis\":\"Flat-maps the Set, returning a new Set.
\\n\",\"description\":\"Similar to set.map(...).flatten(true)
.
Returns a new Set with only the values for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
A type of Set that has the additional guarantee that the iteration order of\\nvalues will be the order in which they were add
ed.
The iteration behavior of OrderedSet is the same as native ES6 Set.
\\nNote that OrderedSet
are more expensive than non-ordered Set
and may\\nconsume more memory. OrderedSet#add
is amortized O(log32 N), but not\\nstable.
True if the provided value is an OrderedSet.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeOrderedSet\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":1774}]}},\"of\":{\"call\":{\"doc\":{\"synopsis\":\"Creates a new OrderedSet containing values
.
OrderedSet.fromKeys()
creates a new immutable OrderedSet containing\\nthe keys from this Collection or JavaScript Object.
Create a new immutable OrderedSet containing the values of the provided\\ncollection-like.
\\n\",\"description\":\"Note: OrderedSet
is a factory function and not a class, and does not use\\nthe new
keyword during construction.
Returns an OrderedSet including any value from collections
that does\\nnot already exist in this OrderedSet.
Note: union
can be used in withMutations
.
Returns a new Set with values passed through a\\nmapper
function.
OrderedSet([ 1, 2 ]).map(x => 10 * x)\\n// OrderedSet [10, 20]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"M\"],\"params\":[{\"name\":\"mapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"M\"}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"OrderedSet\",\"args\":[{\"k\":8,\"param\":\"M\"}]},\"line\":1828}]},\"#flatMap\":{\"doc\":{\"synopsis\":\"Flat-maps the OrderedSet, returning a new OrderedSet.
\\n\",\"description\":\"Similar to set.map(...).flatten(true)
.
Returns a new OrderedSet with only the values for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Returns an OrderedSet of the same type "zipped" with the provided\\ncollections.
\\n\",\"description\":\"Like zipWith
, but using the default zipper
: creating an Array
.
const a = OrderedSet([ 1, 2, 3 ])\\nconst b = OrderedSet([ 4, 5, 6 ])\\nconst c = a.zip(b)\\n// OrderedSet [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"OrderedSet\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":1872},{\"typeParams\":[\"U\",\"V\"],\"params\":[{\"name\":\"other1\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"other2\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"OrderedSet\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":1873},{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"OrderedSet\",\"args\":[{\"k\":0}]},\"line\":1874}]},\"#zipAll\":{\"doc\":{\"synopsis\":\"Returns a OrderedSet of the same type "zipped" with the provided\\ncollections.
\\n\",\"description\":\"Unlike zip
, zipAll
continues zipping until the longest collection is\\nexhausted. Missing values from shorter collections are filled with undefined
.
const a = OrderedSet([ 1, 2 ]);\\nconst b = OrderedSet([ 3, 4, 5 ]);\\nconst c = a.zipAll(b); // OrderedSet [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ]
Note: Since zipAll will return a collection as large as the largest\\ninput, some results may contain undefined values. TypeScript cannot\\naccount for these without cases (as of v2.5).
\\n\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"OrderedSet\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":1893},{\"typeParams\":[\"U\",\"V\"],\"params\":[{\"name\":\"other1\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"other2\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"OrderedSet\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":1894},{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"OrderedSet\",\"args\":[{\"k\":0}]},\"line\":1895}]},\"#zipWith\":{\"doc\":{\"synopsis\":\"Returns an OrderedSet of the same type "zipped" with the provided\\ncollections by using a custom zipper
function.
Seq.Indexed.zipWith
\\n\"}]},\"signatures\":[{\"typeParams\":[\"U\",\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"otherValue\",\"type\":{\"k\":8,\"param\":\"U\"}}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"otherCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"OrderedSet\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":1903},{\"typeParams\":[\"U\",\"V\",\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"otherValue\",\"type\":{\"k\":8,\"param\":\"U\"}},{\"name\":\"thirdValue\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"otherCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"thirdCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"OrderedSet\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":1907},{\"typeParams\":[\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"any\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"varArgs\":true}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"OrderedSet\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":1912}]}}}]}},\"Stack\":{\"doc\":{\"synopsis\":\"Stacks are indexed collections which support very efficient O(1) addition\\nand removal from the front using unshift(v)
and shift()
.
For familiarity, Stack also provides push(v)
, pop()
, and peek()
, but\\nbe aware that they also operate on the front of the list, unlike List or\\na JavaScript Array.
Note: reverse()
or any inherent reverse traversal (reduceRight
,\\nlastIndexOf
, etc.) is not efficient with a Stack.
Stack is implemented with a Single-Linked List.
\\n\",\"notes\":[]},\"module\":{\"isStack\":{\"call\":{\"doc\":{\"synopsis\":\"True if the provided value is a Stack
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeStack\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":1938}]}},\"of\":{\"call\":{\"doc\":{\"synopsis\":\"Creates a new Stack containing values
.
Create a new immutable Stack containing the values of the provided\\ncollection-like.
\\n\",\"description\":\"The iteration order of the provided collection is preserved in the\\nresulting Stack
.
Note: Stack
is a factory function and not a class, and does not use the\\nnew
keyword during construction.
Alias for Stack.first()
.
Returns a new Stack with 0 size and no values.
\\n\",\"description\":\"Note: clear
can be used in withMutations
.
Returns a new Stack with the provided values
prepended, shifting other\\nvalues ahead to higher indices.
This is very efficient for Stack.
\\nNote: unshift
can be used in withMutations
.
Like Stack#unshift
, but accepts a collection rather than varargs.
Note: unshiftAll
can be used in withMutations
.
Returns a new Stack with a size ones less than this Stack, excluding\\nthe first item in this Stack, shifting all other values to a lower index.
\\n\",\"description\":\"Note: this differs from Array#shift
because it returns a new\\nStack rather than the removed value. Use first()
or peek()
to get the\\nfirst value in this Stack.
Note: shift
can be used in withMutations
.
Alias for Stack#unshift
and is not equivalent to List#push
.
Alias for Stack#unshiftAll
.
Alias for Stack#shift
and is not equivalent to List#pop
.
Note: Not all methods can be used on a mutable collection or within\\nwithMutations
! Check the documentation for each method to see if it\\nmentions being safe to use in withMutations
.
Map#withMutations
Note: Not all methods can be used on a mutable collection or within\\nwithMutations
! Check the documentation for each method to see if it\\nmentions being safe to use in withMutations
.
Map#asMutable
Map#wasAltered
Map#asImmutable
Returns a new Stack with other collections concatenated to this one.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"valuesOrCollections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":8,\"param\":\"C\"}]},{\"k\":8,\"param\":\"C\"}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Stack\",\"args\":[{\"k\":13,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"C\"}]}]},\"line\":2064}]},\"#map\":{\"doc\":{\"synopsis\":\"Returns a new Stack with values passed through a\\nmapper
function.
Stack([ 1, 2 ]).map(x => 10 * x)\\n// Stack [ 10, 20 ]
Note: map()
always returns a new instance, even if it produced the same\\nvalue at every step.
Flat-maps the Stack, returning a new Stack.
\\n\",\"description\":\"Similar to stack.map(...).flatten(true)
.
Returns a new Set with only the values for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Returns a Stack "zipped" with the provided collections.
\\n\",\"description\":\"Like zipWith
, but using the default zipper
: creating an Array
.
const a = Stack([ 1, 2, 3 ]);\\nconst b = Stack([ 4, 5, 6 ]);\\nconst c = a.zip(b); // Stack [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"Stack\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":2118},{\"typeParams\":[\"U\",\"V\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"other2\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"Stack\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":2119},{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Stack\",\"args\":[{\"k\":0}]},\"line\":2120}]},\"#zipAll\":{\"doc\":{\"synopsis\":\"Returns a Stack "zipped" with the provided collections.
\\n\",\"description\":\"Unlike zip
, zipAll
continues zipping until the longest collection is\\nexhausted. Missing values from shorter collections are filled with undefined
.
const a = Stack([ 1, 2 ]);\\nconst b = Stack([ 3, 4, 5 ]);\\nconst c = a.zipAll(b); // Stack [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ]
Note: Since zipAll will return a collection as large as the largest\\ninput, some results may contain undefined values. TypeScript cannot\\naccount for these without cases (as of v2.5).
\\n\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"Stack\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":2138},{\"typeParams\":[\"U\",\"V\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"other2\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"Stack\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":2139},{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Stack\",\"args\":[{\"k\":0}]},\"line\":2140}]},\"#zipWith\":{\"doc\":{\"synopsis\":\"Returns a Stack "zipped" with the provided collections by using a\\ncustom zipper
function.
const a = Stack([ 1, 2, 3 ]);\\nconst b = Stack([ 4, 5, 6 ]);\\nconst c = a.zipWith((a, b) => a + b, b);\\n// Stack [ 5, 7, 9 ]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\",\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"otherValue\",\"type\":{\"k\":8,\"param\":\"U\"}}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"otherCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"Stack\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":2153},{\"typeParams\":[\"U\",\"V\",\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"otherValue\",\"type\":{\"k\":8,\"param\":\"U\"}},{\"name\":\"thirdValue\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"otherCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"thirdCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"Stack\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":2157},{\"typeParams\":[\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"any\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"varArgs\":true}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Stack\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":2162}]}}}]}},\"Range\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a Seq.Indexed of numbers from start
(inclusive) to end
\\n(exclusive), by step
, where start
defaults to 0, step
to 1, and end
to\\ninfinity. When start
is equal to end
, returns empty range.
Note: Range
is a factory function and not a class, and does not use the\\nnew
keyword during construction.
const { Range } = require('immutable')\\nRange() // [ 0, 1, 2, 3, ... ]\\nRange(10) // [ 10, 11, 12, 13, ... ]\\nRange(10, 15) // [ 10, 11, 12, 13, 14 ]\\nRange(10, 30, 5) // [ 10, 15, 20, 25 ]\\nRange(30, 10, 5) // [ 30, 25, 20, 15 ]\\nRange(30, 30, 5) // []
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"start\",\"type\":{\"k\":2},\"optional\":true},{\"name\":\"end\",\"type\":{\"k\":2},\"optional\":true},{\"name\":\"step\",\"type\":{\"k\":2},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":2}]},\"line\":2187}]}},\"Repeat\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a Seq.Indexed of value
repeated times
times. When times
is\\nnot defined, returns an infinite Seq
of value
.
Note: Repeat
is a factory function and not a class, and does not use the\\nnew
keyword during construction.
const { Repeat } = require('immutable')\\nRepeat('foo') // [ 'foo', 'foo', 'foo', ... ]\\nRepeat('bar', 4) // [ 'bar', 'bar', 'bar', 'bar' ]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"T\"],\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"times\",\"type\":{\"k\":2},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":2203}]}},\"Record\":{\"doc\":{\"synopsis\":\"A record is similar to a JS object, but enforces a specific set of allowed\\nstring keys, and has default values.
\\n\",\"description\":\"The Record()
function produces new Record Factories, which when called\\ncreate Record instances.
const { Record } = require('immutable')\\nconst ABRecord = Record({ a: 1, b: 2 })\\nconst myRecord = ABRecord({ b: 3 })
Records always have a value for the keys they define. remove
ing a key\\nfrom a record simply resets it to the default value for that key.
myRecord.size // 2\\nmyRecord.get('a') // 1\\nmyRecord.get('b') // 3\\nconst myRecordWithoutB = myRecord.remove('b')\\nmyRecordWithoutB.get('b') // 2\\nmyRecordWithoutB.size // 2
Values provided to the constructor not found in the Record type will\\nbe ignored. For example, in this case, ABRecord is provided a key "x" even\\nthough only "a" and "b" have been defined. The value for "x" will be\\nignored for this record.
\\nconst myRecord = ABRecord({ b: 3, x: 10 })\\nmyRecord.get('x') // undefined
Because Records have a known set of string keys, property get access works\\nas expected, however property sets will throw an Error.
\\nNote: IE8 does not support property access. Only use get()
when\\nsupporting IE8.
myRecord.b // 3\\nmyRecord.b = 5 // throws Error
Record Types can be extended as well, allowing for custom methods on your\\nRecord. This is not a common pattern in functional environments, but is in\\nmany JS programs.
\\nHowever Record Types are more restricted than typical JavaScript classes.\\nThey do not use a class constructor, which also means they cannot use\\nclass properties (since those are technically part of a constructor).
\\nWhile Record Types can be syntactically created with the JavaScript class
\\nform, the resulting Record function is actually a factory function, not a\\nclass constructor. Even though Record Types are not classes, JavaScript\\ncurrently requires the use of new
when creating new Record instances if\\nthey are defined as a class
.
class ABRecord extends Record({ a: 1, b: 2 }) {\\n getAB() {\\n return this.a + this.b;\\n }\\n}\\n\\nvar myRecord = new ABRecord({b: 3})\\nmyRecord.getAB() // 4
Flow Typing Records:
\\nImmutable.js exports two Flow types designed to make it easier to use\\nRecords with flow typed code, RecordOf<TProps>
and RecordFactory<TProps>
.
When defining a new kind of Record factory function, use a flow type that\\ndescribes the values the record contains along with RecordFactory<TProps>
.\\nTo type instances of the Record (which the factory function returns),\\nuse RecordOf<TProps>
.
Typically, new Record definitions will export both the Record factory\\nfunction as well as the Record instance type for use in other code.
\\nimport type { RecordFactory, RecordOf } from 'immutable';\\n\\n// Use RecordFactory<TProps> for defining new Record factory functions.\\ntype Point3DProps = { x: number, y: number, z: number };\\nconst defaultValues: Point3DProps = { x: 0, y: 0, z: 0 };\\nconst makePoint3D: RecordFactory<Point3DProps> = Record(defaultValues);\\nexport makePoint3D;\\n\\n// Use RecordOf<T> for defining new instances of that Record.\\nexport type Point3D = RecordOf<Point3DProps>;\\nconst some3DPoint: Point3D = makePoint3D({ x: 10, y: 20, z: 30 });
Flow Typing Record Subclasses:
\\nRecords can be subclassed as a means to add additional methods to Record\\ninstances. This is generally discouraged in favor of a more functional API,\\nsince Subclasses have some minor overhead. However the ability to create\\na rich API on Record types can be quite valuable.
\\nWhen using Flow to type Subclasses, do not use RecordFactory<TProps>
,\\ninstead apply the props type when subclassing:
type PersonProps = {name: string, age: number};\\nconst defaultValues: PersonProps = {name: 'Aristotle', age: 2400};\\nconst PersonRecord = Record(defaultValues);\\nclass Person extends PersonRecord<PersonProps> {\\n getName(): string {\\n return this.get('name')\\n }\\n\\n setName(name: string): this {\\n return this.set('name', name);\\n }\\n}
Choosing Records vs plain JavaScript objects
\\nRecords offer a persistently immutable alternative to plain JavaScript\\nobjects, however they're not required to be used within Immutable.js\\ncollections. In fact, the deep-access and deep-updating functions\\nlike getIn()
and setIn()
work with plain JavaScript Objects as well.
Deciding to use Records or Objects in your application should be informed\\nby the tradeoffs and relative benefits of each:
\\nRuntime immutability: plain JS objects may be carefully treated as\\nimmutable, however Record instances will throw if attempted to be\\nmutated directly. Records provide this additional guarantee, however at\\nsome marginal runtime cost. While JS objects are mutable by nature, the\\nuse of type-checking tools like Flow\\ncan help gain confidence in code written to favor immutability.
\\nValue equality: Records use value equality when compared with is()
\\nor record.equals()
. That is, two Records with the same keys and values\\nare equal. Plain objects use reference equality. Two objects with the\\nsame keys and values are not equal since they are different objects.\\nThis is important to consider when using objects as keys in a Map
or\\nvalues in a Set
, which use equality when retrieving values.
API methods: Records have a full featured API, with methods like\\n.getIn()
, and .equals()
. These can make working with these values\\neasier, but comes at the cost of not allowing keys with those names.
Default values: Records provide default values for every key, which\\ncan be useful when constructing Records with often unchanging values.\\nHowever default values can make using Flow and TypeScript more laborious.
\\nSerialization: Records use a custom internal representation to\\nefficiently store and update their values. Converting to and from this\\nform isn't free. If converting Records to plain objects is common,\\nconsider sticking with plain objects to begin with.
\\nTrue if maybeRecord
is an instance of a Record.
Records allow passing a second parameter to supply a descriptive name\\nthat appears when converting a Record to a string or in any error\\nmessages. A descriptive name for any record can be accessed by using this\\nmethod. If one was not provided, the string "Record" is returned.
\\n\",\"description\":\"const { Record } = require('immutable')\\nconst Person = Record({\\n name: null\\n}, 'Person')\\n\\nvar me = Person({ name: 'My Name' })\\nme.toString() // \\\"Person { \\\"name\\\": \\\"My Name\\\" }\\\"\\nRecord.getDescriptiveName(me) // \\\"Person\\\"
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"record\",\"type\":{\"k\":9,\"name\":\"Record\",\"args\":[{\"k\":0}]}}],\"type\":{\"k\":3},\"line\":2391}]}},\"Factory\":{\"doc\":{\"synopsis\":\"A Record.Factory is created by the Record()
function. Record instances\\nare created by passing it some of the accepted values for that Record\\ntype:
// makePerson is a Record Factory function\\nconst makePerson = Record({ name: null, favoriteColor: 'unknown' });\\n\\n// alan is a Record instance\\nconst alan = makePerson({ name: 'Alan' });run it
Note that Record Factories return Record<TProps> & Readonly<TProps>
,\\nthis allows use of both the Record instance API, and direct property\\naccess on the resulting instances:
// Use the Record API\\nconsole.log('Record API: ' + alan.get('name'))\\n\\n// Or direct property access (Readonly)\\nconsole.log('property access: ' + alan.name)run it
Flow Typing Records:
\\nUse the RecordFactory<TProps>
Flow type to get high quality type checking of\\nRecords:
import type { RecordFactory, RecordOf } from 'immutable';\\n\\n// Use RecordFactory<TProps> for defining new Record factory functions.\\ntype PersonProps = { name: ?string, favoriteColor: string };\\nconst makePerson: RecordFactory<PersonProps> = Record({ name: null, favoriteColor: 'unknown' });\\n\\n// Use RecordOf<T> for defining new instances of that Record.\\ntype Person = RecordOf<PersonProps>;\\nconst alan: Person = makePerson({ name: 'Alan' });
\",\"notes\":[]},\"module\":{},\"interface\":{\"line\":2443,\"typeParams\":[\"TProps\"],\"groups\":[{\"members\":{\"#displayName\":{\"line\":2451}}}]},\"call\":{\"signatures\":[{\"typeParams\":[\"TProps\"],\"params\":[{\"name\":\"values\",\"type\":{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Partial\",\"args\":[{\"k\":8,\"param\":\"TProps\"}]},{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":15,\"types\":[{\"k\":3},{\"k\":0}]}]}]},\"optional\":true}],\"type\":{\"k\":14,\"types\":[{\"k\":9,\"name\":\"Record\",\"args\":[{\"k\":8,\"param\":\"TProps\"}]},{\"k\":9,\"name\":\"Readonly\",\"args\":[{\"k\":8,\"param\":\"TProps\"}]}]},\"line\":2454}]}}},\"call\":{\"doc\":{\"synopsis\":\"Unlike other types in Immutable.js, the Record()
function creates a new\\nRecord Factory, which is a function that creates Record instances.
See above for examples of using Record()
.
Note: Record
is a factory function and not a class, and does not use the\\nnew
keyword during construction.
Returns the value associated with the provided key, which may be the\\ndefault value defined when creating the Record factory function.
\\n\",\"description\":\"If the requested key is not defined by this Record type, then\\nnotSetValue will be returned if provided. Note that this scenario would\\nproduce an error when using Flow or TypeScript.
\\n\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"K\"],\"params\":[{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"notSetValue\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"TProps\"},\"index\":{\"k\":8,\"param\":\"K\"}},\"line\":2482},{\"typeParams\":[\"T\"],\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}},{\"name\":\"notSetValue\",\"type\":{\"k\":8,\"param\":\"T\"}}],\"type\":{\"k\":8,\"param\":\"T\"},\"line\":2483}]}}},{\"title\":\"Reading deep values\",\"members\":{\"#hasIn\":{\"signatures\":[{\"params\":[{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}}],\"type\":{\"k\":1},\"line\":2487}]},\"#getIn\":{\"signatures\":[{\"params\":[{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}}],\"type\":{\"k\":0},\"line\":2488}]}}},{\"title\":\"Value equality\",\"members\":{\"#equals\":{\"signatures\":[{\"params\":[{\"name\":\"other\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":2492}]},\"#hashCode\":{\"signatures\":[{\"type\":{\"k\":2},\"line\":2493}]}}},{\"title\":\"Persistent changes\",\"members\":{\"#set\":{\"signatures\":[{\"typeParams\":[\"K\"],\"params\":[{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"value\",\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"TProps\"},\"index\":{\"k\":8,\"param\":\"K\"}}}],\"type\":{\"k\":10},\"line\":2497}]},\"#update\":{\"signatures\":[{\"typeParams\":[\"K\"],\"params\":[{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"TProps\"},\"index\":{\"k\":8,\"param\":\"K\"}}}],\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"TProps\"},\"index\":{\"k\":8,\"param\":\"K\"}}}}],\"type\":{\"k\":10},\"line\":2498}]},\"#merge\":{\"signatures\":[{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Partial\",\"args\":[{\"k\":8,\"param\":\"TProps\"}]},{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":15,\"types\":[{\"k\":3},{\"k\":0}]}]}]}]},\"varArgs\":true}],\"type\":{\"k\":10},\"line\":2499}]},\"#mergeDeep\":{\"signatures\":[{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Partial\",\"args\":[{\"k\":8,\"param\":\"TProps\"}]},{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":15,\"types\":[{\"k\":3},{\"k\":0}]}]}]}]},\"varArgs\":true}],\"type\":{\"k\":10},\"line\":2500}]},\"#mergeWith\":{\"signatures\":[{\"params\":[{\"name\":\"merger\",\"type\":{\"k\":7,\"params\":[{\"name\":\"oldVal\",\"type\":{\"k\":0}},{\"name\":\"newVal\",\"type\":{\"k\":0}},{\"name\":\"key\",\"type\":{\"k\":17,\"operator\":\"keyof\",\"type\":{\"k\":8,\"param\":\"TProps\"}}}],\"type\":{\"k\":0}}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Partial\",\"args\":[{\"k\":8,\"param\":\"TProps\"}]},{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":15,\"types\":[{\"k\":3},{\"k\":0}]}]}]}]},\"varArgs\":true}],\"type\":{\"k\":10},\"line\":2502}]},\"#mergeDeepWith\":{\"signatures\":[{\"params\":[{\"name\":\"merger\",\"type\":{\"k\":7,\"params\":[{\"name\":\"oldVal\",\"type\":{\"k\":0}},{\"name\":\"newVal\",\"type\":{\"k\":0}},{\"name\":\"key\",\"type\":{\"k\":0}}],\"type\":{\"k\":0}}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Partial\",\"args\":[{\"k\":8,\"param\":\"TProps\"}]},{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":15,\"types\":[{\"k\":3},{\"k\":0}]}]}]}]},\"varArgs\":true}],\"type\":{\"k\":10},\"line\":2506}]},\"#delete\":{\"doc\":{\"synopsis\":\"Returns a new instance of this Record type with the value for the\\nspecific key set to its default value.
\\n\",\"description\":\"\",\"notes\":[{\"name\":\"alias\",\"body\":\"remove\"}]},\"signatures\":[{\"typeParams\":[\"K\"],\"params\":[{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}}],\"type\":{\"k\":10},\"line\":2517}]},\"#clear\":{\"doc\":{\"synopsis\":\"Returns a new instance of this Record type with all values set\\nto their default values.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":10},\"line\":2524}]}}},{\"title\":\"Deep persistent changes\",\"members\":{\"#setIn\":{\"signatures\":[{\"params\":[{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}},{\"name\":\"value\",\"type\":{\"k\":0}}],\"type\":{\"k\":10},\"line\":2528}]},\"#updateIn\":{\"signatures\":[{\"params\":[{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":0}}],\"type\":{\"k\":0}}}],\"type\":{\"k\":10},\"line\":2529}]},\"#mergeIn\":{\"signatures\":[{\"params\":[{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"varArgs\":true}],\"type\":{\"k\":10},\"line\":2530}]},\"#mergeDeepIn\":{\"signatures\":[{\"params\":[{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"varArgs\":true}],\"type\":{\"k\":10},\"line\":2531}]},\"#deleteIn\":{\"doc\":{\"synopsis\":\"\",\"description\":\"\",\"notes\":[{\"name\":\"alias\",\"body\":\"removeIn\"}]},\"signatures\":[{\"params\":[{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}}],\"type\":{\"k\":10},\"line\":2536}]}}},{\"title\":\"Conversion to JavaScript types\",\"members\":{\"#toJS\":{\"doc\":{\"synopsis\":\"Deeply converts this Record to equivalent native JavaScript Object.
\\n\",\"description\":\"Note: This method may not be overridden. Objects with custom\\nserialization to plain JS may override toJSON() instead.
\\n\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":0}}]},\"line\":2547}]},\"#toJSON\":{\"doc\":{\"synopsis\":\"Shallowly converts this Record to equivalent native JavaScript Object.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":8,\"param\":\"TProps\"},\"line\":2552}]},\"#toObject\":{\"doc\":{\"synopsis\":\"Shallowly converts this Record to equivalent JavaScript Object.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":8,\"param\":\"TProps\"},\"line\":2557}]}}},{\"title\":\"Transient changes\",\"members\":{\"#withMutations\":{\"doc\":{\"synopsis\":\"Note: Not all methods can be used on a mutable collection or within\\nwithMutations
! Only set
may be used mutatively.
Map#withMutations
Map#asMutable
Map#wasAltered
Map#asImmutable
Seq
describes a lazy operation, allowing them to efficiently chain\\nuse of all the higher-order collection methods (such as map
and filter
)\\nby not creating intermediate collections.
Seq is immutable — Once a Seq is created, it cannot be\\nchanged, appended to, rearranged or otherwise modified. Instead, any\\nmutative method called on a Seq
will return a new Seq
.
Seq is lazy — Seq
does as little work as necessary to respond to any\\nmethod call. Values are often created during iteration, including implicit\\niteration when reducing or converting to a concrete data structure such as\\na List
or JavaScript Array
.
For example, the following performs no work, because the resulting\\nSeq
's values are never iterated:
const { Seq } = require('immutable')\\nconst oddSquares = Seq([ 1, 2, 3, 4, 5, 6, 7, 8 ])\\n .filter(x => x % 2 !== 0)\\n .map(x => x * x)
Once the Seq
is used, it performs only the work necessary. In this\\nexample, no intermediate arrays are ever created, filter is called three\\ntimes, and map is only called once:
oddSquares.get(1); // 9
Any collection can be converted to a lazy Seq with Seq()
.
const { Map } = require('immutable')\\nconst map = Map({ a: 1, b: 2, c: 3 }\\nconst lazySeq = Seq(map)run it
Seq
allows for the efficient chaining of operations, allowing for the\\nexpression of logic that can otherwise be very tedious:
lazySeq\\n .flip()\\n .map(key => key.toUpperCase())\\n .flip()\\n// Seq { A: 1, B: 1, C: 1 }
As well as expressing logic that would otherwise seem memory or time\\nlimited, for example Range
is a special kind of Lazy sequence.
const { Range } = require('immutable')\\nRange(1, Infinity)\\n .skip(1000)\\n .map(n => -n)\\n .filter(n => n % 2 === 0)\\n .take(2)\\n .reduce((r, n) => r * n, 1)\\n// 1006008run it
Seq is often used to provide a rich collection API to JavaScript Object.
\\nSeq({ x: 0, y: 1, z: 2 }).map(v => v * 2).toObject();\\n// { x: 0, y: 2, z: 4 }
\",\"notes\":[]},\"module\":{\"isSeq\":{\"call\":{\"doc\":{\"synopsis\":\"True if maybeSeq
is a Seq, it is not backed by a concrete\\nstructure such as Map, List, or Set.
Seq
which represents key-value pairs.
Always returns a Seq.Keyed, if input is not keyed, expects an\\ncollection of [K, V] tuples.
\\n\",\"description\":\"Note: Seq.Keyed
is a conversion function and not a class, and does not\\nuse the new
keyword during construction.
Deeply converts this Keyed Seq to equivalent native JavaScript Object.
\\n\",\"description\":\"Converts keys to Strings.
\\n\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Object\"},\"line\":2706}]},\"#toJSON\":{\"doc\":{\"synopsis\":\"Shallowly converts this Keyed Seq to equivalent native JavaScript Object.
\\n\",\"description\":\"Converts keys to Strings.
\\n\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":8,\"param\":\"V\"}}]},\"line\":2713}]},\"#toArray\":{\"doc\":{\"synopsis\":\"Shallowly converts this collection to an Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":2718}]},\"#toSeq\":{\"doc\":{\"synopsis\":\"Returns itself
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":10},\"line\":2723}]},\"#concat\":{\"doc\":{\"synopsis\":\"Returns a new Seq with other collections concatenated to this one.
\\n\",\"description\":\"All entries will be present in the resulting Seq, even if they\\nhave the same key.
\\n\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"KC\",\"VC\"],\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"KC\"},{\"k\":8,\"param\":\"VC\"}]}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Keyed\",\"args\":[{\"k\":13,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"KC\"}]},{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"VC\"}]}]},\"line\":2731},{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":8,\"param\":\"C\"}}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Keyed\",\"args\":[{\"k\":13,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":3}]},{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"C\"}]}]},\"line\":2732}]},\"#map\":{\"doc\":{\"synopsis\":\"Returns a new Seq.Keyed with values passed through a\\nmapper
function.
const { Seq } = require('immutable')\\nSeq.Keyed({ a: 1, b: 2 }).map(x => 10 * x)\\n// Seq { \\\"a\\\": 10, \\\"b\\\": 20 }
Note: map()
always returns a new instance, even if it produced the\\nsame value at every step.
Collection.Keyed.mapKeys
\\n\"}]},\"signatures\":[{\"typeParams\":[\"M\"],\"params\":[{\"name\":\"mapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"M\"}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Keyed\",\"args\":[{\"k\":8,\"param\":\"M\"},{\"k\":8,\"param\":\"V\"}]},\"line\":2755}]},\"#mapEntries\":{\"doc\":{\"synopsis\":\"\",\"description\":\"\",\"notes\":[{\"name\":\"see\",\"body\":\"Collection.Keyed.mapEntries
\\n\"}]},\"signatures\":[{\"typeParams\":[\"KM\",\"VM\"],\"params\":[{\"name\":\"mapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"entry\",\"type\":{\"k\":15,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]}},{\"name\":\"index\",\"type\":{\"k\":2}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":15,\"types\":[{\"k\":8,\"param\":\"KM\"},{\"k\":8,\"param\":\"VM\"}]}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Keyed\",\"args\":[{\"k\":8,\"param\":\"KM\"},{\"k\":8,\"param\":\"VM\"}]},\"line\":2763}]},\"#flatMap\":{\"doc\":{\"synopsis\":\"Flat-maps the Seq, returning a Seq of the same type.
\\n\",\"description\":\"Similar to seq.map(...).flatten(true)
.
Returns a new Seq with only the entries for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Collection.Keyed.flip
\\n\"}]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq.Keyed\",\"args\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"K\"}]},\"line\":2797}]}}}]}},\"Indexed\":{\"doc\":{\"synopsis\":\"Seq
which represents an ordered indexed list of values.
Provides an Seq.Indexed of the values provided.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"T\"],\"params\":[{\"name\":\"values\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":2809}]}}},\"call\":{\"doc\":{\"synopsis\":\"Always returns Seq.Indexed, discarding associated keys and\\nsupplying incrementing indices.
\\n\",\"description\":\"Note: Seq.Indexed
is a conversion function and not a class, and does\\nnot use the new
keyword during construction.
Deeply converts this Indexed Seq to equivalent native JavaScript Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"line\":2827}]},\"#toJSON\":{\"doc\":{\"synopsis\":\"Shallowly converts this Indexed Seq to equivalent native JavaScript Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":2832}]},\"#toArray\":{\"doc\":{\"synopsis\":\"Shallowly converts this collection to an Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":2837}]},\"#toSeq\":{\"doc\":{\"synopsis\":\"Returns itself
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":10},\"line\":2842}]},\"#concat\":{\"doc\":{\"synopsis\":\"Returns a new Seq with other collections concatenated to this one.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"valuesOrCollections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":8,\"param\":\"C\"}]},{\"k\":8,\"param\":\"C\"}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":13,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"C\"}]}]},\"line\":2847}]},\"#map\":{\"doc\":{\"synopsis\":\"Returns a new Seq.Indexed with values passed through a\\nmapper
function.
const { Seq } = require('immutable')\\nSeq.Indexed([ 1, 2 ]).map(x => 10 * x)\\n// Seq [ 10, 20 ]
Note: map()
always returns a new instance, even if it produced the\\nsame value at every step.
Flat-maps the Seq, returning a a Seq of the same type.
\\n\",\"description\":\"Similar to seq.map(...).flatten(true)
.
Returns a new Seq with only the values for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Returns a Seq "zipped" with the provided collections.
\\n\",\"description\":\"Like zipWith
, but using the default zipper
: creating an Array
.
const a = Seq([ 1, 2, 3 ]);\\nconst b = Seq([ 4, 5, 6 ]);\\nconst c = a.zip(b); // Seq [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":2904},{\"typeParams\":[\"U\",\"V\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"other2\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":2905},{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":0}]},\"line\":2906}]},\"#zipAll\":{\"doc\":{\"synopsis\":\"Returns a Seq "zipped" with the provided collections.
\\n\",\"description\":\"Unlike zip
, zipAll
continues zipping until the longest collection is\\nexhausted. Missing values from shorter collections are filled with undefined
.
const a = Seq([ 1, 2 ]);\\nconst b = Seq([ 3, 4, 5 ]);\\nconst c = a.zipAll(b); // Seq [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":2920},{\"typeParams\":[\"U\",\"V\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"other2\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":2921},{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":0}]},\"line\":2922}]},\"#zipWith\":{\"doc\":{\"synopsis\":\"Returns a Seq "zipped" with the provided collections by using a\\ncustom zipper
function.
const a = Seq([ 1, 2, 3 ]);\\nconst b = Seq([ 4, 5, 6 ]);\\nconst c = a.zipWith((a, b) => a + b, b);\\n// Seq [ 5, 7, 9 ]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\",\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"otherValue\",\"type\":{\"k\":8,\"param\":\"U\"}}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"otherCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":2935},{\"typeParams\":[\"U\",\"V\",\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"otherValue\",\"type\":{\"k\":8,\"param\":\"U\"}},{\"name\":\"thirdValue\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"otherCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"thirdCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":2939},{\"typeParams\":[\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"any\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"varArgs\":true}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":2944}]}}}]}},\"Set\":{\"doc\":{\"synopsis\":\"Seq
which represents a set of values.
Because Seq
are often lazy, Seq.Set
does not provide the same guarantee\\nof value uniqueness as the concrete Set
.
Returns a Seq.Set of the provided values
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"T\"],\"params\":[{\"name\":\"values\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Set\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":2962}]}}},\"call\":{\"doc\":{\"synopsis\":\"Always returns a Seq.Set, discarding associated indices or keys.
\\n\",\"description\":\"Note: Seq.Set
is a conversion function and not a class, and does not\\nuse the new
keyword during construction.
Deeply converts this Set Seq to equivalent native JavaScript Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"line\":2979}]},\"#toJSON\":{\"doc\":{\"synopsis\":\"Shallowly converts this Set Seq to equivalent native JavaScript Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":2984}]},\"#toArray\":{\"doc\":{\"synopsis\":\"Shallowly converts this collection to an Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":2989}]},\"#toSeq\":{\"doc\":{\"synopsis\":\"Returns itself
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":10},\"line\":2994}]},\"#concat\":{\"doc\":{\"synopsis\":\"Returns a new Seq with other collections concatenated to this one.
\\n\",\"description\":\"All entries will be present in the resulting Seq, even if they\\nare duplicates.
\\n\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":8,\"param\":\"U\"}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Set\",\"args\":[{\"k\":13,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":3002}]},\"#map\":{\"doc\":{\"synopsis\":\"Returns a new Seq.Set with values passed through a\\nmapper
function.
Seq.Set([ 1, 2 ]).map(x => 10 * x)\\n// Seq { 10, 20 }
Note: map()
always returns a new instance, even if it produced the\\nsame value at every step.
Flat-maps the Seq, returning a Seq of the same type.
\\n\",\"description\":\"Similar to seq.map(...).flatten(true)
.
Returns a new Seq with only the values for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Creates a Seq.
\\n\",\"description\":\"Returns a particular kind of Seq
based on the input.
Seq
, that same Seq
.Collection
, a Seq
of the same kind (Keyed, Indexed, or Set).Seq.Indexed
.Seq.Indexed
.Seq.Keyed
.Note: An Iterator itself will be treated as an object, becoming a Seq.Keyed
,\\nwhich is usually not what you want. You should turn your Iterator Object into\\nan iterable object by defining a Symbol.iterator (or @@iterator) method which\\nreturns this
.
Note: Seq
is a conversion function and not a class, and does not use the\\nnew
keyword during construction.
Because Sequences are lazy and designed to be chained together, they do\\nnot cache their results. For example, this map function is called a total\\nof 6 times, as each join
iterates the Seq of three values.
var squares = Seq([ 1, 2, 3 ]).map(x => x * x)\\nsquares.join() + squares.join()
If you know a Seq
will be used multiple times, it may be more\\nefficient to first cache it in memory. Here, the map function is called\\nonly 3 times.
var squares = Seq([ 1, 2, 3 ]).map(x => x * x).cacheResult()\\nsquares.join() + squares.join()
Use this method judiciously, as it must fully evaluate a Seq which can be\\na burden on memory and possibly performance.
\\nNote: after calling cacheResult
, a Seq will always have a size
.
Returns a new Seq with values passed through a\\nmapper
function.
const { Seq } = require('immutable')\\nSeq([ 1, 2 ]).map(x => 10 * x)\\n// Seq [ 10, 20 ]
Note: map()
always returns a new instance, even if it produced the same\\nvalue at every step.\\nNote: used only for sets.
Flat-maps the Seq, returning a Seq of the same type.
\\n\",\"description\":\"Similar to seq.map(...).flatten(true)
.\\nNote: Used only for sets.
Returns a new Seq with only the values for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
The Collection
is a set of (key, value) entries which can be iterated, and\\nis the base class for all collections in immutable
, allowing them to\\nmake use of all the Collection methods (such as map
and filter
).
Note: A collection is always iterated in the same order, however that order\\nmay not always be well defined, as is the case for the Map
and Set
.
Collection is the abstract base class for concrete data structures. It\\ncannot be constructed directly.
\\nImplementations should extend one of the subclasses, Collection.Keyed
,\\nCollection.Indexed
, or Collection.Set
.
Keyed Collections have discrete keys tied to each value.
\\n\",\"description\":\"When iterating Collection.Keyed
, each iteration will yield a [K, V]
\\ntuple, in other words, Collection#entries
is the default iterator for\\nKeyed Collections.
Creates a Collection.Keyed
\\n\",\"description\":\"Similar to Collection()
, however it expects collection-likes of [K, V]\\ntuples if not constructed from a Collection.Keyed or JS Object.
Note: Collection.Keyed
is a conversion function and not a class, and\\ndoes not use the new
keyword during construction.
Deeply converts this Keyed collection to equivalent native JavaScript Object.
\\n\",\"description\":\"Converts keys to Strings.
\\n\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Object\"},\"line\":3257}]},\"#toJSON\":{\"doc\":{\"synopsis\":\"Shallowly converts this Keyed collection to equivalent native JavaScript Object.
\\n\",\"description\":\"Converts keys to Strings.
\\n\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":8,\"param\":\"V\"}}]},\"line\":3264}]},\"#toArray\":{\"doc\":{\"synopsis\":\"Shallowly converts this collection to an Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":3269}]},\"#toSeq\":{\"doc\":{\"synopsis\":\"Returns Seq.Keyed.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq.Keyed\",\"args\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]},\"line\":3275}]}}},{\"title\":\"Sequence functions\",\"members\":{\"#flip\":{\"doc\":{\"synopsis\":\"Returns a new Collection.Keyed of the same type where the keys and values\\nhave been flipped.
\\n\",\"description\":\"\\nconst { Map } = require('immutable')\\nMap({ a: 'z', b: 'y' }).flip()\\n// Map { \\\"z\\\": \\\"a\\\", \\\"y\\\": \\\"b\\\" }run it
\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Collection.Keyed\",\"args\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"K\"}]},\"line\":3291}]},\"#concat\":{\"doc\":{\"synopsis\":\"Returns a new Collection with other collections concatenated to this one.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"KC\",\"VC\"],\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"KC\"},{\"k\":8,\"param\":\"VC\"}]}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Collection.Keyed\",\"args\":[{\"k\":13,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"KC\"}]},{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"VC\"}]}]},\"line\":3296},{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":8,\"param\":\"C\"}}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Collection.Keyed\",\"args\":[{\"k\":13,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":3}]},{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"C\"}]}]},\"line\":3297}]},\"#map\":{\"doc\":{\"synopsis\":\"Returns a new Collection.Keyed with values passed through a\\nmapper
function.
const { Collection } = require('immutable')\\nCollection.Keyed({ a: 1, b: 2 }).map(x => 10 * x)\\n// Seq { \\\"a\\\": 10, \\\"b\\\": 20 }
Note: map()
always returns a new instance, even if it produced the\\nsame value at every step.
Returns a new Collection.Keyed of the same type with keys passed through\\na mapper
function.
const { Map } = require('immutable')\\nMap({ a: 1, b: 2 }).mapKeys(x => x.toUpperCase())\\n// Map { \\\"A\\\": 1, \\\"B\\\": 2 }run it
Note: mapKeys()
always returns a new instance, even if it produced\\nthe same key at every step.
Returns a new Collection.Keyed of the same type with entries\\n([key, value] tuples) passed through a mapper
function.
const { Map } = require('immutable')\\nMap({ a: 1, b: 2 })\\n .mapEntries(([ k, v ]) => [ k.toUpperCase(), v * 2 ])\\n// Map { \\\"A\\\": 2, \\\"B\\\": 4 }run it
Note: mapEntries()
always returns a new instance, even if it produced\\nthe same entry at every step.
Flat-maps the Collection, returning a Collection of the same type.
\\n\",\"description\":\"Similar to collection.map(...).flatten(true)
.
Returns a new Collection with only the values for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Indexed Collections have incrementing numeric keys. They exhibit\\nslightly different behavior than Collection.Keyed
for some methods in order\\nto better mirror the behavior of JavaScript's Array
, and add methods\\nwhich do not make sense on non-indexed Collections such as indexOf
.
Unlike JavaScript arrays, Collection.Indexed
s are always dense. "Unset"\\nindices and undefined
indices are indistinguishable, and all indices from\\n0 to size
are visited when iterated.
All Collection.Indexed methods return re-indexed Collections. In other words,\\nindices always start at 0 and increment until size. If you wish to\\npreserve indices, using them as keys, convert to a Collection.Keyed by\\ncalling toKeyedSeq
.
Creates a new Collection.Indexed.
\\n\",\"description\":\"Note: Collection.Indexed
is a conversion function and not a class, and\\ndoes not use the new
keyword during construction.
Deeply converts this Indexed collection to equivalent native JavaScript Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"line\":3415}]},\"#toJSON\":{\"doc\":{\"synopsis\":\"Shallowly converts this Indexed collection to equivalent native JavaScript Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":3420}]},\"#toArray\":{\"doc\":{\"synopsis\":\"Shallowly converts this collection to an Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":3425}]}}},{\"title\":\"Reading values\",\"members\":{\"#get\":{\"doc\":{\"synopsis\":\"Returns the value associated with the provided index, or notSetValue if\\nthe index is beyond the bounds of the Collection.
\\n\",\"description\":\"index
may be a negative number, which indexes back from the end of the\\nCollection. s.get(-1)
gets the last item in the Collection.
Returns Seq.Indexed.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":3446}]},\"#fromEntrySeq\":{\"doc\":{\"synopsis\":\"If this is a collection of [key, value] entry tuples, it will return a\\nSeq.Keyed of those entries.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq.Keyed\",\"args\":[{\"k\":0},{\"k\":0}]},\"line\":3452}]}}},{\"title\":\"Combination\",\"members\":{\"#interpose\":{\"doc\":{\"synopsis\":\"Returns a Collection of the same type with separator
between each item\\nin this Collection.
Returns a Collection of the same type with the provided collections
\\ninterleaved into this collection.
The resulting Collection includes the first item from each, then the\\nsecond from each, etc.
\\n\\nconst { List } = require('immutable')\\nList([ 1, 2, 3 ]).interleave(List([ 'A', 'B', 'C' ]))\\n// List [ 1, \\\"A\\\", 2, \\\"B\\\", 3, \\\"C\\\"\\\" ]run it
The shortest Collection stops interleave.
\\n\\nList([ 1, 2, 3 ]).interleave(\\n List([ 'A', 'B' ]),\\n List([ 'X', 'Y', 'Z' ])\\n)\\n// List [ 1, \\\"A\\\", \\\"X\\\", 2, \\\"B\\\", \\\"Y\\\"\\\" ]run it
Since interleave()
re-indexes values, it produces a complete copy,\\nwhich has O(N)
complexity.
Note: interleave
cannot be used in withMutations
.
Splice returns a new indexed Collection by replacing a region of this\\nCollection with new values. If values are not provided, it only skips the\\nregion to be removed.
\\n\",\"description\":\"index
may be a negative number, which indexes back from the end of the\\nCollection. s.splice(-2)
splices after the second to last item.
const { List } = require('immutable')\\nList([ 'a', 'b', 'c', 'd' ]).splice(1, 2, 'q', 'r', 's')\\n// List [ \\\"a\\\", \\\"q\\\", \\\"r\\\", \\\"s\\\", \\\"d\\\" ]run it
Since splice()
re-indexes values, it produces a complete copy, which\\nhas O(N)
complexity.
Note: splice
cannot be used in withMutations
.
Returns a Collection of the same type "zipped" with the provided\\ncollections.
\\n\",\"description\":\"Like zipWith
, but using the default zipper
: creating an Array
.
const a = List([ 1, 2, 3 ]);\\nconst b = List([ 4, 5, 6 ]);\\nconst c = a.zip(b); // List [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"Collection.Indexed\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":3541},{\"typeParams\":[\"U\",\"V\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"other2\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"Collection.Indexed\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":3542},{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Collection.Indexed\",\"args\":[{\"k\":0}]},\"line\":3543}]},\"#zipAll\":{\"doc\":{\"synopsis\":\"Returns a Collection "zipped" with the provided collections.
\\n\",\"description\":\"Unlike zip
, zipAll
continues zipping until the longest collection is\\nexhausted. Missing values from shorter collections are filled with undefined
.
const a = List([ 1, 2 ]);\\nconst b = List([ 3, 4, 5 ]);\\nconst c = a.zipAll(b); // List [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ]
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"Collection.Indexed\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":3557},{\"typeParams\":[\"U\",\"V\"],\"params\":[{\"name\":\"other\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"other2\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"Collection.Indexed\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":3558},{\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Collection.Indexed\",\"args\":[{\"k\":0}]},\"line\":3559}]},\"#zipWith\":{\"doc\":{\"synopsis\":\"Returns a Collection of the same type "zipped" with the provided\\ncollections by using a custom zipper
function.
const a = List([ 1, 2, 3 ]);\\nconst b = List([ 4, 5, 6 ]);\\nconst c = a.zipWith((a, b) => a + b, b);\\n// List [ 5, 7, 9 ]run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\",\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"otherValue\",\"type\":{\"k\":8,\"param\":\"U\"}}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"otherCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}}],\"type\":{\"k\":9,\"name\":\"Collection.Indexed\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":3575},{\"typeParams\":[\"U\",\"V\",\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"otherValue\",\"type\":{\"k\":8,\"param\":\"U\"}},{\"name\":\"thirdValue\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"otherCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"U\"}]}},{\"name\":\"thirdCollection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":8,\"param\":\"V\"}]}}],\"type\":{\"k\":9,\"name\":\"Collection.Indexed\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":3579},{\"typeParams\":[\"Z\"],\"params\":[{\"name\":\"zipper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"any\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"varArgs\":true}],\"type\":{\"k\":8,\"param\":\"Z\"}}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Collection.Indexed\",\"args\":[{\"k\":8,\"param\":\"Z\"}]},\"line\":3584}]}}},{\"title\":\"Search for value\",\"members\":{\"#indexOf\":{\"doc\":{\"synopsis\":\"Returns the first index at which a given value can be found in the\\nCollection, or -1 if it is not present.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"searchValue\",\"type\":{\"k\":8,\"param\":\"T\"}}],\"type\":{\"k\":2},\"line\":3596}]},\"#lastIndexOf\":{\"doc\":{\"synopsis\":\"Returns the last index at which a given value can be found in the\\nCollection, or -1 if it is not present.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"searchValue\",\"type\":{\"k\":8,\"param\":\"T\"}}],\"type\":{\"k\":2},\"line\":3602}]},\"#findIndex\":{\"doc\":{\"synopsis\":\"Returns the first index in the Collection where a value satisfies the\\nprovided predicate function. Otherwise -1 is returned.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"predicate\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"index\",\"type\":{\"k\":2}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":1}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":2},\"line\":3608}]},\"#findLastIndex\":{\"doc\":{\"synopsis\":\"Returns the last index in the Collection where a value satisfies the\\nprovided predicate function. Otherwise -1 is returned.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"predicate\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"T\"}},{\"name\":\"index\",\"type\":{\"k\":2}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":1}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":2},\"line\":3617}]}}},{\"title\":\"Sequence algorithms\",\"members\":{\"#concat\":{\"doc\":{\"synopsis\":\"Returns a new Collection with other collections concatenated to this one.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"valuesOrCollections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":8,\"param\":\"C\"}]},{\"k\":8,\"param\":\"C\"}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Collection.Indexed\",\"args\":[{\"k\":13,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"C\"}]}]},\"line\":3627}]},\"#map\":{\"doc\":{\"synopsis\":\"Returns a new Collection.Indexed with values passed through a\\nmapper
function.
const { Collection } = require('immutable')\\nCollection.Indexed([1,2]).map(x => 10 * x)\\n// Seq [ 1, 2 ]
Note: map()
always returns a new instance, even if it produced the\\nsame value at every step.
Flat-maps the Collection, returning a Collection of the same type.
\\n\",\"description\":\"Similar to collection.map(...).flatten(true)
.
Returns a new Collection with only the values for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Set Collections only represent values. They have no associated keys or\\nindices. Duplicate values are possible in the lazy Seq.Set
s, however\\nthe concrete Set
Collection does not allow duplicate values.
Collection methods on Collection.Set such as map
and forEach
will provide\\nthe value as both the first and second arguments to the provided function.
const { Collection } = require('immutable')\\nconst seq = Collection.Set([ 'A', 'B', 'C' ])\\n// Seq { \\\"A\\\", \\\"B\\\", \\\"C\\\" }\\nseq.forEach((v, k) =>\\n assert.equal(v, k)\\n)
\",\"notes\":[]},\"module\":{},\"call\":{\"doc\":{\"synopsis\":\"Similar to Collection()
, but always returns a Collection.Set.
Note: Collection.Set
is a factory function and not a class, and does\\nnot use the new
keyword during construction.
Deeply converts this Set collection to equivalent native JavaScript Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"line\":3708}]},\"#toJSON\":{\"doc\":{\"synopsis\":\"Shallowly converts this Set collection to equivalent native JavaScript Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":3713}]},\"#toArray\":{\"doc\":{\"synopsis\":\"Shallowly converts this collection to an Array.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":3718}]},\"#toSeq\":{\"doc\":{\"synopsis\":\"Returns Seq.Set.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq.Set\",\"args\":[{\"k\":8,\"param\":\"T\"}]},\"line\":3724}]}}},{\"title\":\"Sequence algorithms\",\"members\":{\"#concat\":{\"doc\":{\"synopsis\":\"Returns a new Collection with other collections concatenated to this one.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"U\"],\"params\":[{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":8,\"param\":\"U\"}]}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Collection.Set\",\"args\":[{\"k\":13,\"types\":[{\"k\":8,\"param\":\"T\"},{\"k\":8,\"param\":\"U\"}]}]},\"line\":3731}]},\"#map\":{\"doc\":{\"synopsis\":\"Returns a new Collection.Set with values passed through a\\nmapper
function.
Collection.Set([ 1, 2 ]).map(x => 10 * x)\\n// Seq { 1, 2 }
Note: map()
always returns a new instance, even if it produced the\\nsame value at every step.
Flat-maps the Collection, returning a Collection of the same type.
\\n\",\"description\":\"Similar to collection.map(...).flatten(true)
.
Returns a new Collection with only the values for which the predicate
\\nfunction returns true.
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Creates a Collection.
\\n\",\"description\":\"The type of Collection created is based on the input.
\\nCollection
, that same Collection
.Collection.Indexed
.Collection.Indexed
.Collection.Keyed
.This methods forces the conversion of Objects and Strings to Collections.\\nIf you want to ensure that a Collection of one item is returned, use\\nSeq.of
.
Note: An Iterator itself will be treated as an object, becoming a Seq.Keyed
,\\nwhich is usually not what you want. You should turn your Iterator Object into\\nan iterable object by defining a Symbol.iterator (or @@iterator) method which\\nreturns this
.
Note: Collection
is a conversion function and not a class, and does not\\nuse the new
keyword during construction.
True if this and the other Collection have value equality, as defined\\nby Immutable.is()
.
Note: This is equivalent to Immutable.is(this, other)
, but provided to\\nallow for chained expressions.
Computes and returns the hashed identity for this Collection.
\\n\",\"description\":\"The hashCode
of a Collection is used to determine potential equality,\\nand is used when adding this to a Set
or as a key in a Map
, enabling\\nlookup via a different instance.
const a = List([ 1, 2, 3 ]);\\nconst b = List([ 1, 2, 3 ]);\\nassert.notStrictEqual(a, b); // different instances\\nconst set = Set([ a ]);\\nassert.equal(set.has(b), true);run it
If two values have the same hashCode
, they are not guaranteed\\nto be equal. If two values have different hashCode
s,\\nthey must not be equal.
Returns the value associated with the provided key, or notSetValue if\\nthe Collection does not contain this key.
\\n\",\"description\":\"Note: it is possible a key may be associated with an undefined
value,\\nso if notSetValue
is not provided and this method returns undefined
,\\nthat does not guarantee the key was not found.
True if a key exists within this Collection
, using Immutable.is
\\nto determine equality
True if a value exists within this Collection
, using Immutable.is
\\nto determine equality
In case the Collection
is not empty returns the first element of the\\nCollection
.\\nIn case the Collection
is empty returns the optional default\\nvalue if provided, if no default value is provided returns undefined.
In case the Collection
is not empty returns the last element of the\\nCollection
.\\nIn case the Collection
is empty returns the optional default\\nvalue if provided, if no default value is provided returns undefined.
Returns the value found by following a path of keys or indices through\\nnested Collections.
\\n\",\"description\":\"\\nconst { Map, List } = require('immutable')\\nconst deepData = Map({ x: List([ Map({ y: 123 }) ]) });\\ndeepData.getIn(['x', 0, 'y']) // 123run it
Plain JavaScript Object or Arrays may be nested within an Immutable.js\\nCollection, and getIn() can access those values as well:
\\n\\nconst { Map, List } = require('immutable')\\nconst deepData = Map({ x: [ { y: 123 } ] });\\ndeepData.getIn(['x', 0, 'y']) // 123run it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"searchKeyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}},{\"name\":\"notSetValue\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":0},\"line\":3913}]},\"#hasIn\":{\"doc\":{\"synopsis\":\"True if the result of following a path of keys or indices through nested\\nCollections results in a set value.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"searchKeyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}}],\"type\":{\"k\":1},\"line\":3919}]}}},{\"title\":\"Persistent changes\",\"members\":{\"#update\":{\"doc\":{\"synopsis\":\"This can be very useful as a way to "chain" a normal function into a\\nsequence of methods. RxJS calls this "let" and lodash calls it "thru".
\\n\",\"description\":\"For example, to sum a Seq after mapping and filtering:
\\n\\nconst { Seq } = require('immutable')\\n\\nfunction sum(collection) {\\n return collection.reduce((sum, x) => sum + x, 0)\\n}\\n\\nSeq([ 1, 2, 3 ])\\n .map(x => x + 1)\\n .filter(x => x % 2 === 0)\\n .update(sum)\\n// 6run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"R\"],\"params\":[{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"R\"}}}],\"type\":{\"k\":8,\"param\":\"R\"},\"line\":3944}]}}},{\"title\":\"Conversion to JavaScript types\",\"members\":{\"#toJS\":{\"doc\":{\"synopsis\":\"Deeply converts this Collection to equivalent native JavaScript Array or Object.
\\n\",\"description\":\"Collection.Indexed
, and Collection.Set
become Array
, while\\nCollection.Keyed
become Object
, converting keys to Strings.
Shallowly converts this Collection to equivalent native JavaScript Array or Object.
\\n\",\"description\":\"Collection.Indexed
, and Collection.Set
become Array
, while\\nCollection.Keyed
become Object
, converting keys to Strings.
Shallowly converts this collection to an Array.
\\n\",\"description\":\"Collection.Indexed
, and Collection.Set
produce an Array of values.\\nCollection.Keyed
produce an Array of [key, value] tuples.
Shallowly converts this Collection to an Object.
\\n\",\"description\":\"Converts keys to Strings.
\\n\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":8,\"param\":\"V\"}}]},\"line\":3978}]}}},{\"title\":\"Conversion to Collections\",\"members\":{\"#toMap\":{\"doc\":{\"synopsis\":\"Converts this Collection to a Map, Throws if keys are not hashable.
\\n\",\"description\":\"Note: This is equivalent to Map(this.toKeyedSeq())
, but provided\\nfor convenience and to allow for chained expressions.
Converts this Collection to a Map, maintaining the order of iteration.
\\n\",\"description\":\"Note: This is equivalent to OrderedMap(this.toKeyedSeq())
, but\\nprovided for convenience and to allow for chained expressions.
Converts this Collection to a Set, discarding keys. Throws if values\\nare not hashable.
\\n\",\"description\":\"Note: This is equivalent to Set(this)
, but provided to allow for\\nchained expressions.
Converts this Collection to a Set, maintaining the order of iteration and\\ndiscarding keys.
\\n\",\"description\":\"Note: This is equivalent to OrderedSet(this.valueSeq())
, but provided\\nfor convenience and to allow for chained expressions.
Converts this Collection to a List, discarding keys.
\\n\",\"description\":\"This is similar to List(collection)
, but provided to allow for chained\\nexpressions. However, when called on Map
or other keyed collections,\\ncollection.toList()
discards the keys and creates a list of only the\\nvalues, whereas List(collection)
creates a list of entry tuples.
const { Map, List } = require('immutable')\\nvar myMap = Map({ a: 'Apple', b: 'Banana' })\\nList(myMap) // List [ [ \\\"a\\\", \\\"Apple\\\" ], [ \\\"b\\\", \\\"Banana\\\" ] ]\\nmyMap.toList() // List [ \\\"Apple\\\", \\\"Banana\\\" ]run it
\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"List\",\"args\":[{\"k\":8,\"param\":\"V\"}]},\"line\":4033}]},\"#toStack\":{\"doc\":{\"synopsis\":\"Converts this Collection to a Stack, discarding keys. Throws if values\\nare not hashable.
\\n\",\"description\":\"Note: This is equivalent to Stack(this)
, but provided to allow for\\nchained expressions.
Converts this Collection to a Seq of the same kind (indexed,\\nkeyed, or set).
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq\",\"args\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]},\"line\":4051}]},\"#toKeyedSeq\":{\"doc\":{\"synopsis\":\"Returns a Seq.Keyed from this Collection where indices are treated as keys.
\\n\",\"description\":\"This is useful if you want to operate on an\\nCollection.Indexed and preserve the [index, value] pairs.
\\nThe returned Seq will have identical iteration order as\\nthis Collection.
\\n\\nconst { Seq } = require('immutable')\\nconst indexedSeq = Seq([ 'A', 'B', 'C' ])\\n// Seq [ \\\"A\\\", \\\"B\\\", \\\"C\\\" ]\\nindexedSeq.filter(v => v === 'B')\\n// Seq [ \\\"B\\\" ]\\nconst keyedSeq = indexedSeq.toKeyedSeq()\\n// Seq { 0: \\\"A\\\", 1: \\\"B\\\", 2: \\\"C\\\" }\\nkeyedSeq.filter(v => v === 'B')\\n// Seq { 1: \\\"B\\\" }run it
\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq.Keyed\",\"args\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]},\"line\":4075}]},\"#toIndexedSeq\":{\"doc\":{\"synopsis\":\"Returns an Seq.Indexed of the values of this Collection, discarding keys.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":8,\"param\":\"V\"}]},\"line\":4080}]},\"#toSetSeq\":{\"doc\":{\"synopsis\":\"Returns a Seq.Set of the values of this Collection, discarding keys.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq.Set\",\"args\":[{\"k\":8,\"param\":\"V\"}]},\"line\":4085}]}}},{\"title\":\"Iterators\",\"members\":{\"#keys\":{\"doc\":{\"synopsis\":\"An iterator of this Collection
's keys.
Note: this will return an ES6 iterator which does not support\\nImmutable.js sequence algorithms. Use keySeq
instead, if this is\\nwhat you want.
An iterator of this Collection
's values.
Note: this will return an ES6 iterator which does not support\\nImmutable.js sequence algorithms. Use valueSeq
instead, if this is\\nwhat you want.
An iterator of this Collection
's entries as [ key, value ]
tuples.
Note: this will return an ES6 iterator which does not support\\nImmutable.js sequence algorithms. Use entrySeq
instead, if this is\\nwhat you want.
Returns a new Seq.Indexed of the keys of this Collection,\\ndiscarding values.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":8,\"param\":\"K\"}]},\"line\":4124}]},\"#valueSeq\":{\"doc\":{\"synopsis\":\"Returns an Seq.Indexed of the values of this Collection, discarding keys.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":8,\"param\":\"V\"}]},\"line\":4129}]},\"#entrySeq\":{\"doc\":{\"synopsis\":\"Returns a new Seq.Indexed of [key, value] tuples.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":9,\"name\":\"Seq.Indexed\",\"args\":[{\"k\":15,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":4134}]}}},{\"title\":\"Sequence algorithms\",\"members\":{\"#map\":{\"doc\":{\"synopsis\":\"Returns a new Collection of the same type with values passed through a\\nmapper
function.
const { Collection } = require('immutable')\\nCollection({ a: 1, b: 2 }).map(x => 10 * x)\\n// Seq { \\\"a\\\": 10, \\\"b\\\": 20 }run it
Note: map()
always returns a new instance, even if it produced the same\\nvalue at every step.
Returns a new Collection of the same type with only the entries for which\\nthe predicate
function returns true.
const { Map } = require('immutable')\\nMap({ a: 1, b: 2, c: 3, d: 4}).filter(x => x % 2 === 0)\\n// Map { \\\"b\\\": 2, \\\"d\\\": 4 }run it
Note: filter()
always returns a new instance, even if it results in\\nnot filtering out any values.
Returns a new Collection of the same type with only the entries for which\\nthe predicate
function returns false.
const { Map } = require('immutable')\\nMap({ a: 1, b: 2, c: 3, d: 4}).filterNot(x => x % 2 === 0)\\n// Map { \\\"a\\\": 1, \\\"c\\\": 3 }run it
Note: filterNot()
always returns a new instance, even if it results in\\nnot filtering out any values.
Returns a new Collection of the same type in reverse order.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":10},\"line\":4211}]},\"#sort\":{\"doc\":{\"synopsis\":\"Returns a new Collection of the same type which includes the same entries,\\nstably sorted by using a comparator
.
If a comparator
is not provided, a default comparator uses <
and >
.
comparator(valueA, valueB)
:
0
if the elements should not be swapped.-1
(or any negative number) if valueA
comes before valueB
1
(or any positive number) if valueA
comes after valueB
When sorting collections which have no defined order, their ordered\\nequivalents will be returned. e.g. map.sort()
returns OrderedMap.
const { Map } = require('immutable')\\nMap({ \\\"c\\\": 3, \\\"a\\\": 1, \\\"b\\\": 2 }).sort((a, b) => {\\n if (a < b) { return -1; }\\n if (a > b) { return 1; }\\n if (a === b) { return 0; }\\n});\\n// OrderedMap { \\\"a\\\": 1, \\\"b\\\": 2, \\\"c\\\": 3 }run it
Note: sort()
Always returns a new instance, even if the original was\\nalready sorted.
Note: This is always an eager operation.
\\n\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"comparator\",\"type\":{\"k\":7,\"params\":[{\"name\":\"valueA\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"valueB\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":2}},\"optional\":true}],\"type\":{\"k\":10},\"line\":4246}]},\"#sortBy\":{\"doc\":{\"synopsis\":\"Like sort
, but also accepts a comparatorValueMapper
which allows for\\nsorting by more sophisticated means:
hitters.sortBy(hitter => hitter.avgHits)
Note: sortBy()
Always returns a new instance, even if the original was\\nalready sorted.
Note: This is always an eager operation.
\\n\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"comparatorValueMapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"C\"}}},{\"name\":\"comparator\",\"type\":{\"k\":7,\"params\":[{\"name\":\"valueA\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"valueB\",\"type\":{\"k\":8,\"param\":\"C\"}}],\"type\":{\"k\":2}},\"optional\":true}],\"type\":{\"k\":10},\"line\":4259}]},\"#groupBy\":{\"doc\":{\"synopsis\":\"Returns a Collection.Keyed
of Collection.Keyeds
, grouped by the return\\nvalue of the grouper
function.
Note: This is always an eager operation.
\\n\\nconst { List, Map } = require('immutable')\\nconst listOfMaps = List([\\n Map({ v: 0 }),\\n Map({ v: 1 }),\\n Map({ v: 1 }),\\n Map({ v: 0 }),\\n Map({ v: 2 })\\n])\\nconst groupsOfMaps = listOfMaps.groupBy(x => x.get('v'))\\n// Map {\\n// 0: List [ Map{ \\\"v\\\": 0 }, Map { \\\"v\\\": 0 } ],\\n// 1: List [ Map{ \\\"v\\\": 1 }, Map { \\\"v\\\": 1 } ],\\n// 2: List [ Map{ \\\"v\\\": 2 } ],\\n// }run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"G\"],\"params\":[{\"name\":\"grouper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"G\"}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"Seq.Keyed\",\"args\":[{\"k\":8,\"param\":\"G\"},{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]}]},\"line\":4288}]}}},{\"title\":\"Side effects\",\"members\":{\"#forEach\":{\"doc\":{\"synopsis\":\"The sideEffect
is executed for every entry in the Collection.
Unlike Array#forEach
, if any call of sideEffect
returns\\nfalse
, the iteration will stop. Returns the number of entries iterated\\n(including the last iteration which returned false).
Returns a new Collection of the same type representing a portion of this\\nCollection from start up to but not including end.
\\n\",\"description\":\"If begin is negative, it is offset from the end of the Collection. e.g.\\nslice(-2)
returns a Collection of the last two entries. If it is not\\nprovided the new Collection will begin at the beginning of this Collection.
If end is negative, it is offset from the end of the Collection. e.g.\\nslice(0, -1)
returns a Collection of everything but the last entry. If\\nit is not provided, the new Collection will continue through the end of\\nthis Collection.
If the requested slice is equivalent to the current Collection, then it\\nwill return itself.
\\n\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"begin\",\"type\":{\"k\":2},\"optional\":true},{\"name\":\"end\",\"type\":{\"k\":2},\"optional\":true}],\"type\":{\"k\":10},\"line\":4327}]},\"#rest\":{\"doc\":{\"synopsis\":\"Returns a new Collection of the same type containing all entries except\\nthe first.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":10},\"line\":4333}]},\"#butLast\":{\"doc\":{\"synopsis\":\"Returns a new Collection of the same type containing all entries except\\nthe last.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"type\":{\"k\":10},\"line\":4339}]},\"#skip\":{\"doc\":{\"synopsis\":\"Returns a new Collection of the same type which excludes the first amount
\\nentries from this Collection.
Returns a new Collection of the same type which excludes the last amount
\\nentries from this Collection.
Returns a new Collection of the same type which includes entries starting\\nfrom when predicate
first returns false.
const { List } = require('immutable')\\nList([ 'dog', 'frog', 'cat', 'hat', 'god' ])\\n .skipWhile(x => x.match(/g/))\\n// List [ \\\"cat\\\", \\\"hat\\\", \\\"god\\\"\\\" ]run it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"predicate\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":1}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":10},\"line\":4365}]},\"#skipUntil\":{\"doc\":{\"synopsis\":\"Returns a new Collection of the same type which includes entries starting\\nfrom when predicate
first returns true.
const { List } = require('immutable')\\nList([ 'dog', 'frog', 'cat', 'hat', 'god' ])\\n .skipUntil(x => x.match(/hat/))\\n// List [ \\\"hat\\\", \\\"god\\\"\\\" ]run it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"predicate\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":1}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":10},\"line\":4382}]},\"#take\":{\"doc\":{\"synopsis\":\"Returns a new Collection of the same type which includes the first amount
\\nentries from this Collection.
Returns a new Collection of the same type which includes the last amount
\\nentries from this Collection.
Returns a new Collection of the same type which includes entries from this\\nCollection as long as the predicate
returns true.
const { List } = require('immutable')\\nList([ 'dog', 'frog', 'cat', 'hat', 'god' ])\\n .takeWhile(x => x.match(/o/))\\n// List [ \\\"dog\\\", \\\"frog\\\" ]run it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"predicate\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":1}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":10},\"line\":4411}]},\"#takeUntil\":{\"doc\":{\"synopsis\":\"Returns a new Collection of the same type which includes entries from this\\nCollection as long as the predicate
returns false.
const { List } = require('immutable')\\nList([ 'dog', 'frog', 'cat', 'hat', 'god' ])\\n .takeUntil(x => x.match(/at/))\\n// List [ \\\"dog\\\", \\\"frog\\\" ]run it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"predicate\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":1}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":10},\"line\":4428}]}}},{\"title\":\"Combination\",\"members\":{\"#concat\":{\"doc\":{\"synopsis\":\"Returns a new Collection of the same type with other values and\\ncollection-like concatenated to this one.
\\n\",\"description\":\"For Seqs, all entries will be present in the resulting Seq, even if they\\nhave the same key.
\\n\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"valuesOrCollections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":0}]},\"varArgs\":true}],\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":0},{\"k\":0}]},\"line\":4443}]},\"#flatten\":{\"doc\":{\"synopsis\":\"Flattens nested Collections.
\\n\",\"description\":\"Will deeply flatten the Collection by default, returning a Collection of the\\nsame type, but a depth
can be provided in the form of a number or\\nboolean (where true means to shallowly flatten one level). A depth of 0\\n(or shallow: false) will deeply flatten.
Flattens only others Collection, not Arrays or Objects.
\\nNote: flatten(true)
operates on Collection<any, Collection<K, V>> and\\nreturns Collection<K, V>
Flat-maps the Collection, returning a Collection of the same type.
\\n\",\"description\":\"Similar to collection.map(...).flatten(true)
.\\nUsed for Dictionaries only.
Reduces the Collection to a value by calling the reducer
for every entry\\nin the Collection and passing along the reduced value.
If initialReduction
is not provided, the first item in the\\nCollection will be used.
Reduces the Collection in reverse (from the right side).
\\n\",\"description\":\"Note: Similar to this.reverse().reduce(), and provided for parity\\nwith Array#reduceRight
.
True if predicate
returns true for all entries in the Collection.
True if predicate
returns true for any entry in the Collection.
Joins values together as a string, inserting a separator between each.\\nThe default separator is \\\",\\\"
.
Returns true if this Collection includes no values.
\\n\",\"description\":\"For some lazy Seq
, isEmpty
might need to iterate to determine\\nemptiness. At most one iteration will occur.
Returns the size of this Collection.
\\n\",\"description\":\"Regardless of if this Collection can describe its size lazily (some Seqs\\ncannot), this method will always return the correct size. E.g. it\\nevaluates a lazy Seq
if necessary.
If predicate
is provided, then this returns the count of entries in the\\nCollection for which the predicate
returns true.
Returns a Seq.Keyed
of counts, grouped by the return value of\\nthe grouper
function.
Note: This is not a lazy operation.
\\n\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"G\"],\"params\":[{\"name\":\"grouper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"G\"}}},{\"name\":\"context\",\"type\":{\"k\":0},\"optional\":true}],\"type\":{\"k\":9,\"name\":\"Map\",\"args\":[{\"k\":8,\"param\":\"G\"},{\"k\":2}]},\"line\":4569}]}}},{\"title\":\"Search for value\",\"members\":{\"#find\":{\"doc\":{\"synopsis\":\"Returns the first value for which the predicate
returns true.
Returns the last value for which the predicate
returns true.
Note: predicate
will be called for each entry in reverse.
Returns the first [key, value] entry for which the predicate
returns true.
Returns the last [key, value] entry for which the predicate
\\nreturns true.
Note: predicate
will be called for each entry in reverse.
Returns the key for which the predicate
returns true.
Returns the last key for which the predicate
returns true.
Note: predicate
will be called for each entry in reverse.
Returns the key associated with the search value, or undefined.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"searchValue\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":11}]},\"line\":4639}]},\"#lastKeyOf\":{\"doc\":{\"synopsis\":\"Returns the last key associated with the search value, or undefined.
\\n\",\"description\":\"\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"searchValue\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"K\"},{\"k\":11}]},\"line\":4644}]},\"#max\":{\"doc\":{\"synopsis\":\"Returns the maximum value in this collection. If any values are\\ncomparatively equivalent, the first one found will be returned.
\\n\",\"description\":\"The comparator
is used in the same way as Collection#sort
. If it is not\\nprovided, the default comparator is >
.
When two values are considered equivalent, the first encountered will be\\nreturned. Otherwise, max
will operate independent of the order of input\\nas long as the comparator is commutative. The default comparator >
is\\ncommutative only when types do not differ.
If comparator
returns 0 and either value is NaN, undefined, or null,\\nthat value will be returned.
Like max
, but also accepts a comparatorValueMapper
which allows for\\ncomparing by more sophisticated means:
hitters.maxBy(hitter => hitter.avgHits);
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"comparatorValueMapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"C\"}}},{\"name\":\"comparator\",\"type\":{\"k\":7,\"params\":[{\"name\":\"valueA\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"valueB\",\"type\":{\"k\":8,\"param\":\"C\"}}],\"type\":{\"k\":2}},\"optional\":true}],\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":11}]},\"line\":4670}]},\"#min\":{\"doc\":{\"synopsis\":\"Returns the minimum value in this collection. If any values are\\ncomparatively equivalent, the first one found will be returned.
\\n\",\"description\":\"The comparator
is used in the same way as Collection#sort
. If it is not\\nprovided, the default comparator is <
.
When two values are considered equivalent, the first encountered will be\\nreturned. Otherwise, min
will operate independent of the order of input\\nas long as the comparator is commutative. The default comparator <
is\\ncommutative only when types do not differ.
If comparator
returns 0 and either value is NaN, undefined, or null,\\nthat value will be returned.
Like min
, but also accepts a comparatorValueMapper
which allows for\\ncomparing by more sophisticated means:
hitters.minBy(hitter => hitter.avgHits);
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"comparatorValueMapper\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"iter\",\"type\":{\"k\":10}}],\"type\":{\"k\":8,\"param\":\"C\"}}},{\"name\":\"comparator\",\"type\":{\"k\":7,\"params\":[{\"name\":\"valueA\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"valueB\",\"type\":{\"k\":8,\"param\":\"C\"}}],\"type\":{\"k\":2}},\"optional\":true}],\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":11}]},\"line\":4699}]}}},{\"title\":\"Comparison\",\"members\":{\"#isSubset\":{\"doc\":{\"synopsis\":\"True if iter
includes every value in this Collection.
True if this Collection includes every value in iter
.
The interface to fulfill to qualify as a Value Object.
\\n\",\"description\":\"\",\"notes\":[]},\"groups\":[{\"members\":{\"#equals\":{\"doc\":{\"synopsis\":\"True if this and the other Collection have value equality, as defined\\nby Immutable.is()
.
Note: This is equivalent to Immutable.is(this, other)
, but provided to\\nallow for chained expressions.
Computes and returns the hashed identity for this Collection.
\\n\",\"description\":\"The hashCode
of a Collection is used to determine potential equality,\\nand is used when adding this to a Set
or as a key in a Map
, enabling\\nlookup via a different instance.
const { List, Set } = require('immutable');\\nconst a = List([ 1, 2, 3 ]);\\nconst b = List([ 1, 2, 3 ]);\\nassert.notStrictEqual(a, b); // different instances\\nconst set = Set([ a ]);\\nassert.equal(set.has(b), true);run it
Note: hashCode() MUST return a Uint32 number. The easiest way to\\nguarantee this is to return myHash | 0
from a custom implementation.
If two values have the same hashCode
, they are not guaranteed\\nto be equal. If two values have different hashCode
s,\\nthey must not be equal.
Note: hashCode()
is not guaranteed to always be called before\\nequals()
. Most but not all Immutable.js collections use hash codes to\\norganize their internal data structures, while all Immutable.js\\ncollections use equality during lookups.
Deeply converts plain JS objects and arrays to Immutable Maps and Lists.
\\n\",\"description\":\"If a reviver
is optionally provided, it will be called with every\\ncollection as a Seq (beginning with the most nested collections\\nand proceeding to the top-level collection itself), along with the key\\nreferring to each collection and the parent JS object provided as this
.\\nFor the top level, object, the key will be \\\"\\\"
. This reviver
is expected\\nto return a new Immutable Collection, allowing for custom conversions from\\ndeep JS objects. Finally, a path
is provided which is the sequence of\\nkeys to this value from the starting value.
reviver
acts similarly to the same parameter in JSON.parse
.
If reviver
is not provided, the default behavior will convert Objects\\ninto Maps and Arrays into Lists like so:
const { fromJS, isKeyed } = require('immutable')\\nfunction (key, value) {\\n return isKeyed(value) ? value.toMap() : value.toList()\\n}run it
fromJS
is conservative in its conversion. It will only convert\\narrays which pass Array.isArray
to Lists, and only raw objects (no custom\\nprototype) to Map.
Accordingly, this example converts native JS data to OrderedMap and List:
\\n\\nconst { fromJS, isKeyed } = require('immutable')\\nfromJS({ a: {b: [10, 20, 30]}, c: 40}, function (key, value, path) {\\n console.log(key, value, path)\\n return isKeyed(value) ? value.toOrderedMap() : value.toList()\\n})\\n\\n> \\\"b\\\", [ 10, 20, 30 ], [ \\\"a\\\", \\\"b\\\" ]\\n> \\\"a\\\", {b: [10, 20, 30]}, [ \\\"a\\\" ]\\n> \\\"\\\", {a: {b: [10, 20, 30]}, c: 40}, []run it
Keep in mind, when using JS objects to construct Immutable Maps, that\\nJavaScript Object properties are always strings, even if written in a\\nquote-less shorthand, while Immutable Maps accept keys of any type.
\\n\\nconst { Map } = require('immutable')\\nlet obj = { 1: \\\"one\\\" };\\nObject.keys(obj); // [ \\\"1\\\" ]\\nassert.equal(obj[\\\"1\\\"], obj[1]); // \\\"one\\\" === \\\"one\\\"\\n\\nlet map = Map(obj);\\nassert.notEqual(map.get(\\\"1\\\"), map.get(1)); // \\\"one\\\" !== undefinedrun it
Property access for JavaScript Objects first converts the key to a string,\\nbut since Immutable Map keys can be of any type the argument to get()
is\\nnot altered.
Value equality check with semantics similar to Object.is
, but treats\\nImmutable Collection
s as values, equal if the second Collection
includes\\nequivalent values.
It's used throughout Immutable when checking for equality, including Map
\\nkey equality and Set
membership.
const { Map, is } = require('immutable')\\nconst map1 = Map({ a: 1, b: 1, c: 1 })\\nconst map2 = Map({ a: 1, b: 1, c: 1 })\\nassert.equal(map1 !== map2, true)\\nassert.equal(Object.is(map1, map2), false)\\nassert.equal(is(map1, map2), true)run it
is()
compares primitive types like strings and numbers, Immutable.js\\ncollections like Map
and List
, but also any custom object which\\nimplements ValueObject
by providing equals()
and hashCode()
methods.
Note: Unlike Object.is
, Immutable.is
assumes 0
and -0
are the same\\nvalue, matching the behavior of ES6 Map key equality.
The hash()
function is an important part of how Immutable determines if\\ntwo values are equivalent and is used to determine how to store those\\nvalues. Provided with any value, hash()
will return a 31-bit integer.
When designing Objects which may be equal, it's important that when a\\n.equals()
method returns true, that both values .hashCode()
method\\nreturn the same value. hash()
may be used to produce those values.
For non-Immutable Objects that do not provide a .hashCode()
functions\\n(including plain Objects, plain Arrays, Date objects, etc), a unique hash\\nvalue will be created for each instance. That is, the create hash\\nrepresents referential equality, and not value equality for Objects. This\\nensures that if that Object is mutated over time that its hash code will\\nremain consistent, allowing Objects to be used as keys and values in\\nImmutable.js collections.
Note that hash()
attempts to balance between speed and avoiding\\ncollisions, however it makes no attempt to produce secure hashes.
New in Version 4.0
\\n\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"value\",\"type\":{\"k\":0}}],\"type\":{\"k\":2},\"line\":4889}]}},\"isImmutable\":{\"call\":{\"doc\":{\"synopsis\":\"True if maybeImmutable
is an Immutable Collection or Record.
Note: Still returns true even if the collections is within a withMutations()
.
const { isImmutable, Map, List, Stack } = require('immutable');\\nisImmutable([]); // false\\nisImmutable({}); // false\\nisImmutable(Map()); // true\\nisImmutable(List()); // true\\nisImmutable(Stack()); // true\\nisImmutable(Map().asMutable()); // truerun it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeImmutable\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":4907}]}},\"isCollection\":{\"call\":{\"doc\":{\"synopsis\":\"True if maybeCollection
is a Collection, or any of its subclasses.
const { isCollection, Map, List, Stack } = require('immutable');\\nisCollection([]); // false\\nisCollection({}); // false\\nisCollection(Map()); // true\\nisCollection(List()); // true\\nisCollection(Stack()); // truerun it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeCollection\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":4922}]}},\"isKeyed\":{\"call\":{\"doc\":{\"synopsis\":\"True if maybeKeyed
is a Collection.Keyed, or any of its subclasses.
const { isKeyed, Map, List, Stack } = require('immutable');\\nisKeyed([]); // false\\nisKeyed({}); // false\\nisKeyed(Map()); // true\\nisKeyed(List()); // false\\nisKeyed(Stack()); // falserun it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeKeyed\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":4937}]}},\"isIndexed\":{\"call\":{\"doc\":{\"synopsis\":\"True if maybeIndexed
is a Collection.Indexed, or any of its subclasses.
const { isIndexed, Map, List, Stack, Set } = require('immutable');\\nisIndexed([]); // false\\nisIndexed({}); // false\\nisIndexed(Map()); // false\\nisIndexed(List()); // true\\nisIndexed(Stack()); // true\\nisIndexed(Set()); // falserun it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeIndexed\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":4953}]}},\"isAssociative\":{\"call\":{\"doc\":{\"synopsis\":\"True if maybeAssociative
is either a Keyed or Indexed Collection.
const { isAssociative, Map, List, Stack, Set } = require('immutable');\\nisAssociative([]); // false\\nisAssociative({}); // false\\nisAssociative(Map()); // true\\nisAssociative(List()); // true\\nisAssociative(Stack()); // true\\nisAssociative(Set()); // falserun it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeAssociative\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":4969}]}},\"isOrdered\":{\"call\":{\"doc\":{\"synopsis\":\"True if maybeOrdered
is a Collection where iteration order is well\\ndefined. True for Collection.Indexed as well as OrderedMap and OrderedSet.
const { isOrdered, Map, OrderedMap, List, Set } = require('immutable');\\nisOrdered([]); // false\\nisOrdered({}); // false\\nisOrdered(Map()); // false\\nisOrdered(OrderedMap()); // true\\nisOrdered(List()); // true\\nisOrdered(Set()); // falserun it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeOrdered\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":4986}]}},\"isValueObject\":{\"call\":{\"doc\":{\"synopsis\":\"True if maybeValue
is a JavaScript Object which has both equals()
\\nand hashCode()
methods.
Any two instances of value objects can be compared for value equality with\\nImmutable.is()
and can be used as keys in a Map
or members in a Set
.
True if maybeSeq
is a Seq.
True if maybeList
is a List.
True if maybeMap
is a Map.
Also true for OrderedMaps.
\\n\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeMap\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":5013}]}},\"isOrderedMap\":{\"call\":{\"doc\":{\"synopsis\":\"True if maybeOrderedMap
is an OrderedMap.
True if maybeStack
is a Stack.
True if maybeSet
is a Set.
Also true for OrderedSets.
\\n\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"maybeSet\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":5030}]}},\"isOrderedSet\":{\"call\":{\"doc\":{\"synopsis\":\"True if maybeOrderedSet
is an OrderedSet.
True if maybeRecord
is a Record.
Returns the value within the provided collection associated with the\\nprovided key, or notSetValue if the key is not defined in the collection.
\\n\",\"description\":\"A functional alternative to collection.get(key)
which will also work on\\nplain Objects and Arrays as an alternative for collection[key]
.
const { get } = require('immutable')\\nget([ 'dog', 'frog', 'cat' ], 2) // 'frog'\\nget({ x: 123, y: 456 }, 'x') // 123\\nget({ x: 123, y: 456 }, 'z', 'ifNotSet') // 'ifNotSet'run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"K\",\"V\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}}],\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":11}]},\"line\":5059},{\"typeParams\":[\"K\",\"V\",\"NSV\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":9,\"name\":\"Collection\",\"args\":[{\"k\":8,\"param\":\"K\"},{\"k\":8,\"param\":\"V\"}]}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"notSetValue\",\"type\":{\"k\":8,\"param\":\"NSV\"}}],\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"NSV\"}]},\"line\":5060},{\"typeParams\":[\"TProps\",\"K\"],\"params\":[{\"name\":\"record\",\"type\":{\"k\":9,\"name\":\"Record\",\"args\":[{\"k\":8,\"param\":\"TProps\"}]}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"notSetValue\",\"type\":{\"k\":0}}],\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"TProps\"},\"index\":{\"k\":8,\"param\":\"K\"}},\"line\":5061},{\"typeParams\":[\"V\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"V\"}]}},{\"name\":\"key\",\"type\":{\"k\":2}}],\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":11}]},\"line\":5062},{\"typeParams\":[\"V\",\"NSV\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"V\"}]}},{\"name\":\"key\",\"type\":{\"k\":2}},{\"name\":\"notSetValue\",\"type\":{\"k\":8,\"param\":\"NSV\"}}],\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"NSV\"}]},\"line\":5063},{\"typeParams\":[\"C\",\"K\"],\"params\":[{\"name\":\"object\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"notSetValue\",\"type\":{\"k\":0}}],\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"C\"},\"index\":{\"k\":8,\"param\":\"K\"}},\"line\":5064},{\"typeParams\":[\"V\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":8,\"param\":\"V\"}}]}},{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":11}]},\"line\":5065},{\"typeParams\":[\"V\",\"NSV\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":8,\"param\":\"V\"}}]}},{\"name\":\"key\",\"type\":{\"k\":3}},{\"name\":\"notSetValue\",\"type\":{\"k\":8,\"param\":\"NSV\"}}],\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"NSV\"}]},\"line\":5066}]}},\"has\":{\"call\":{\"doc\":{\"synopsis\":\"Returns true if the key is defined in the provided collection.
\\n\",\"description\":\"A functional alternative to collection.has(key)
which will also work with\\nplain Objects and Arrays as an alternative for\\ncollection.hasOwnProperty(key)
.
const { has } = require('immutable')\\nhas([ 'dog', 'frog', 'cat' ], 2) // true\\nhas([ 'dog', 'frog', 'cat' ], 5) // false\\nhas({ x: 123, y: 456 }, 'x') // true\\nhas({ x: 123, y: 456 }, 'z') // falserun it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"collection\",\"type\":{\"k\":9,\"name\":\"Object\"}},{\"name\":\"key\",\"type\":{\"k\":0}}],\"type\":{\"k\":1},\"line\":5084}]}},\"remove\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a copy of the collection with the value at key removed.
\\n\",\"description\":\"A functional alternative to collection.remove(key)
which will also work\\nwith plain Objects and Arrays as an alternative for\\ndelete collectionCopy[key]
.
const { remove } = require('immutable')\\nconst originalArray = [ 'dog', 'frog', 'cat' ]\\nremove(originalArray, 1) // [ 'dog', 'cat' ]\\nconsole.log(originalArray) // [ 'dog', 'frog', 'cat' ]\\nconst originalObject = { x: 123, y: 456 }\\nremove(originalObject, 'x') // { y: 456 }\\nconsole.log(originalObject) // { x: 123, y: 456 }run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"K\",\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5104},{\"typeParams\":[\"TProps\",\"C\",\"K\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5105},{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":2}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5106},{\"typeParams\":[\"C\",\"K\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5107},{\"typeParams\":[\"C\",\"K\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5108}]}},\"set\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a copy of the collection with the value at key set to the provided\\nvalue.
\\n\",\"description\":\"A functional alternative to collection.set(key, value)
which will also\\nwork with plain Objects and Arrays as an alternative for\\ncollectionCopy[key] = value
.
const { set } = require('immutable')\\nconst originalArray = [ 'dog', 'frog', 'cat' ]\\nset(originalArray, 1, 'cow') // [ 'dog', 'cow', 'cat' ]\\nconsole.log(originalArray) // [ 'dog', 'frog', 'cat' ]\\nconst originalObject = { x: 123, y: 456 }\\nset(originalObject, 'x', 789) // { x: 789, y: 456 }\\nconsole.log(originalObject) // { x: 123, y: 456 }run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"K\",\"V\",\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5129},{\"typeParams\":[\"TProps\",\"C\",\"K\"],\"params\":[{\"name\":\"record\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"value\",\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"TProps\"},\"index\":{\"k\":8,\"param\":\"K\"}}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5130},{\"typeParams\":[\"V\",\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":2}},{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5131},{\"typeParams\":[\"C\",\"K\"],\"params\":[{\"name\":\"object\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"value\",\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"C\"},\"index\":{\"k\":8,\"param\":\"K\"}}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5132},{\"typeParams\":[\"V\",\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":3}},{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5133}]}},\"update\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a copy of the collection with the value at key set to the result of\\nproviding the existing value to the updating function.
\\n\",\"description\":\"A functional alternative to collection.update(key, fn)
which will also\\nwork with plain Objects and Arrays as an alternative for\\ncollectionCopy[key] = fn(collection[key])
.
const { update } = require('immutable')\\nconst originalArray = [ 'dog', 'frog', 'cat' ]\\nupdate(originalArray, 1, val => val.toUpperCase()) // [ 'dog', 'FROG', 'cat' ]\\nconsole.log(originalArray) // [ 'dog', 'frog', 'cat' ]\\nconst originalObject = { x: 123, y: 456 }\\nupdate(originalObject, 'x', val => val * 6) // { x: 738, y: 456 }\\nconsole.log(originalObject) // { x: 123, y: 456 }run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"K\",\"V\",\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":8,\"param\":\"V\"}}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5154},{\"typeParams\":[\"K\",\"V\",\"C\",\"NSV\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"notSetValue\",\"type\":{\"k\":8,\"param\":\"NSV\"}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"NSV\"}]}}],\"type\":{\"k\":8,\"param\":\"V\"}}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5155},{\"typeParams\":[\"TProps\",\"C\",\"K\"],\"params\":[{\"name\":\"record\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"TProps\"},\"index\":{\"k\":8,\"param\":\"K\"}}}],\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"TProps\"},\"index\":{\"k\":8,\"param\":\"K\"}}}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5156},{\"typeParams\":[\"TProps\",\"C\",\"K\",\"NSV\"],\"params\":[{\"name\":\"record\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"notSetValue\",\"type\":{\"k\":8,\"param\":\"NSV\"}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":13,\"types\":[{\"k\":16,\"type\":{\"k\":8,\"param\":\"TProps\"},\"index\":{\"k\":8,\"param\":\"K\"}},{\"k\":8,\"param\":\"NSV\"}]}}],\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"TProps\"},\"index\":{\"k\":8,\"param\":\"K\"}}}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5157},{\"typeParams\":[\"V\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"V\"}]}},{\"name\":\"key\",\"type\":{\"k\":2}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":8,\"param\":\"V\"}}}],\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"V\"}]},\"line\":5158},{\"typeParams\":[\"V\",\"NSV\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"V\"}]}},{\"name\":\"key\",\"type\":{\"k\":2}},{\"name\":\"notSetValue\",\"type\":{\"k\":8,\"param\":\"NSV\"}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"NSV\"}]}}],\"type\":{\"k\":8,\"param\":\"V\"}}}],\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":8,\"param\":\"V\"}]},\"line\":5159},{\"typeParams\":[\"C\",\"K\"],\"params\":[{\"name\":\"object\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"C\"},\"index\":{\"k\":8,\"param\":\"K\"}}}],\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"C\"},\"index\":{\"k\":8,\"param\":\"K\"}}}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5160},{\"typeParams\":[\"C\",\"K\",\"NSV\"],\"params\":[{\"name\":\"object\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"notSetValue\",\"type\":{\"k\":8,\"param\":\"NSV\"}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":13,\"types\":[{\"k\":16,\"type\":{\"k\":8,\"param\":\"C\"},\"index\":{\"k\":8,\"param\":\"K\"}},{\"k\":8,\"param\":\"NSV\"}]}}],\"type\":{\"k\":16,\"type\":{\"k\":8,\"param\":\"C\"},\"index\":{\"k\":8,\"param\":\"K\"}}}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5161},{\"typeParams\":[\"V\",\"C\",\"K\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":8,\"param\":\"V\"}}],\"type\":{\"k\":8,\"param\":\"V\"}}}],\"type\":{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":8,\"param\":\"V\"}}]},\"line\":5162},{\"typeParams\":[\"V\",\"C\",\"K\",\"NSV\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"key\",\"type\":{\"k\":8,\"param\":\"K\"}},{\"name\":\"notSetValue\",\"type\":{\"k\":8,\"param\":\"NSV\"}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":13,\"types\":[{\"k\":8,\"param\":\"V\"},{\"k\":8,\"param\":\"NSV\"}]}}],\"type\":{\"k\":8,\"param\":\"V\"}}}],\"type\":{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":8,\"param\":\"V\"}}]},\"line\":5163}]}},\"getIn\":{\"call\":{\"doc\":{\"synopsis\":\"Returns the value at the provided key path starting at the provided\\ncollection, or notSetValue if the key path is not defined.
\\n\",\"description\":\"A functional alternative to collection.getIn(keypath)
which will also\\nwork with plain Objects and Arrays.
const { getIn } = require('immutable')\\ngetIn({ x: { y: { z: 123 }}}, ['x', 'y', 'z']) // 123\\ngetIn({ x: { y: { z: 123 }}}, ['x', 'q', 'p'], 'ifNotSet') // 'ifNotSet'run it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"collection\",\"type\":{\"k\":0}},{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}},{\"name\":\"notSetValue\",\"type\":{\"k\":0}}],\"type\":{\"k\":0},\"line\":5179}]}},\"hasIn\":{\"call\":{\"doc\":{\"synopsis\":\"Returns true if the key path is defined in the provided collection.
\\n\",\"description\":\"A functional alternative to collection.hasIn(keypath)
which will also\\nwork with plain Objects and Arrays.
const { hasIn } = require('immutable')\\nhasIn({ x: { y: { z: 123 }}}, ['x', 'y', 'z']) // true\\nhasIn({ x: { y: { z: 123 }}}, ['x', 'q', 'p']) // falserun it
\",\"notes\":[]},\"signatures\":[{\"params\":[{\"name\":\"collection\",\"type\":{\"k\":0}},{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}}],\"type\":{\"k\":1},\"line\":5194}]}},\"removeIn\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a copy of the collection with the value at the key path removed.
\\n\",\"description\":\"A functional alternative to collection.removeIn(keypath)
which will also\\nwork with plain Objects and Arrays.
const { removeIn } = require('immutable')\\nconst original = { x: { y: { z: 123 }}}\\nremoveIn(original, ['x', 'y', 'z']) // { x: { y: {}}}\\nconsole.log(original) // { x: { y: { z: 123 }}}run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5210}]}},\"setIn\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a copy of the collection with the value at the key path set to the\\nprovided value.
\\n\",\"description\":\"A functional alternative to collection.setIn(keypath)
which will also\\nwork with plain Objects and Arrays.
const { setIn } = require('immutable')\\nconst original = { x: { y: { z: 123 }}}\\nsetIn(original, ['x', 'y', 'z'], 456) // { x: { y: { z: 456 }}}\\nconsole.log(original) // { x: { y: { z: 123 }}}run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}},{\"name\":\"value\",\"type\":{\"k\":0}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5227}]}},\"updateIn\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a copy of the collection with the value at key path set to the\\nresult of providing the existing value to the updating function.
\\n\",\"description\":\"A functional alternative to collection.updateIn(keypath)
which will also\\nwork with plain Objects and Arrays.
const { updateIn } = require('immutable')\\nconst original = { x: { y: { z: 123 }}}\\nupdateIn(original, ['x', 'y', 'z'], val => val * 6) // { x: { y: { z: 738 }}}\\nconsole.log(original) // { x: { y: { z: 123 }}}run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":0}}],\"type\":{\"k\":0}}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5244},{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"keyPath\",\"type\":{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]}},{\"name\":\"notSetValue\",\"type\":{\"k\":0}},{\"name\":\"updater\",\"type\":{\"k\":7,\"params\":[{\"name\":\"value\",\"type\":{\"k\":0}}],\"type\":{\"k\":0}}}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5245}]}},\"merge\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a copy of the collection with the remaining collections merged in.
\\n\",\"description\":\"A functional alternative to collection.merge()
which will also work with\\nplain Objects and Arrays.
const { merge } = require('immutable')\\nconst original = { x: 123, y: 456 }\\nmerge(original, { y: 789, z: 'abc' }) // { x: 123, y: 789, z: 'abc' }\\nconsole.log(original) // { x: 123, y: 456 }run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]},{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":15,\"types\":[{\"k\":0},{\"k\":0}]}]},{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":0}}]}]}]},\"varArgs\":true}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5261}]}},\"mergeWith\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a copy of the collection with the remaining collections merged in,\\ncalling the merger
function whenever an existing value is encountered.
A functional alternative to collection.mergeWith()
which will also work\\nwith plain Objects and Arrays.
const { mergeWith } = require('immutable')\\nconst original = { x: 123, y: 456 }\\nmergeWith(\\n (oldVal, newVal) => oldVal + newVal,\\n original,\\n { y: 789, z: 'abc' }\\n) // { x: 123, y: 1245, z: 'abc' }\\nconsole.log(original) // { x: 123, y: 456 }run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"merger\",\"type\":{\"k\":7,\"params\":[{\"name\":\"oldVal\",\"type\":{\"k\":0}},{\"name\":\"newVal\",\"type\":{\"k\":0}},{\"name\":\"key\",\"type\":{\"k\":0}}],\"type\":{\"k\":0}}},{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]},{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":15,\"types\":[{\"k\":0},{\"k\":0}]}]},{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":0}}]}]}]},\"varArgs\":true}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5285}]}},\"mergeDeep\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a copy of the collection with the remaining collections merged in\\ndeeply (recursively).
\\n\",\"description\":\"A functional alternative to collection.mergeDeep()
which will also work\\nwith plain Objects and Arrays.
const { mergeDeep } = require('immutable')\\nconst original = { x: { y: 123 }}\\nmergeDeep(original, { x: { z: 456 }}) // { x: { y: 123, z: 456 }}\\nconsole.log(original) // { x: { y: 123 }}run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]},{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":15,\"types\":[{\"k\":0},{\"k\":0}]}]},{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":0}}]}]}]},\"varArgs\":true}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5306}]}},\"mergeDeepWith\":{\"call\":{\"doc\":{\"synopsis\":\"Returns a copy of the collection with the remaining collections merged in\\ndeeply (recursively), calling the merger
function whenever an existing\\nvalue is encountered.
A functional alternative to collection.mergeDeepWith()
which will also\\nwork with plain Objects and Arrays.
const { mergeDeepWith } = require('immutable')\\nconst original = { x: { y: 123 }}\\nmergeDeepWith(\\n (oldVal, newVal) => oldVal + newVal,\\n original,\\n { x: { y: 456 }}\\n) // { x: { y: 579 }}\\nconsole.log(original) // { x: { y: 123 }}run it
\",\"notes\":[]},\"signatures\":[{\"typeParams\":[\"C\"],\"params\":[{\"name\":\"merger\",\"type\":{\"k\":7,\"params\":[{\"name\":\"oldVal\",\"type\":{\"k\":0}},{\"name\":\"newVal\",\"type\":{\"k\":0}},{\"name\":\"key\",\"type\":{\"k\":0}}],\"type\":{\"k\":0}}},{\"name\":\"collection\",\"type\":{\"k\":8,\"param\":\"C\"}},{\"name\":\"collections\",\"type\":{\"k\":9,\"name\":\"Array\",\"args\":[{\"k\":13,\"types\":[{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":0}]},{\"k\":9,\"name\":\"Iterable\",\"args\":[{\"k\":15,\"types\":[{\"k\":0},{\"k\":0}]}]},{\"k\":4,\"members\":[{\"index\":true,\"params\":[{\"name\":\"key\",\"type\":{\"k\":3}}],\"type\":{\"k\":0}}]}]}]},\"varArgs\":true}],\"type\":{\"k\":8,\"param\":\"C\"},\"line\":5331}]}}},\"version\":\"4.0.0-rc.12\",\"isLatestVersion\":true},\"immutable\":{\"module\":{}}}");