The maximum size of the map
The maximum limit of this map
Returns an iterable of entries in the map.
Identical to Array.at(). Returns the item at a given index, allowing for positive and negative integers. Negative integers count back from the last item in the collection.
The index of the element to obtain
Creates an identical shallow copy of this collection.
Combines this collection with others into a new collection. None of the source collections are modified.
Collections to merge
The difference method returns a new structure containing items where the key is present in one of the original structures but not the other.
The other Collection to filter against
Identical to Map.forEach(), but returns the collection instead of undefined.
Function to execute for each element
Obtains the value of the given key if it exists, otherwise sets and returns the value provided by the default value generator.
The key to get if it exists, or set otherwise
A function that generates the default value
Returns an iterable of key, value pairs for every entry in the map.
Checks if this collection shares identical items with another. This is different to checking for equality using equal-signs, because the collections may be different objects, but contain the same data.
Collection to compare with
Whether the collections have identical contents
Checks if all items passes a test. Identical in behavior to Array.every().
Function used to test (should return a boolean)
Identical to Array.filter(), but returns a Collection instead of an Array.
The function to test with (should return boolean)
Searches for a single item where the given function returns a truthy value. This behaves like
Array.find().
id
property, and if you want to find by id you
should use the get
method. See
MDN for details.
The function to test with (should return boolean)
Searches for the key of a single item where the given function returns a truthy value. This behaves like Array.findIndex(), but returns the key rather than the positional index.
The function to test with (should return boolean)
Obtains the first value(s) in this collection.
A single value if no amount is provided or an array of values, starting from the end if amount is negative
Obtains the first key(s) in this collection.
A single key if no amount is provided or an array of keys, starting from the end if amount is negative
Maps each item into a Collection, then joins the results into a single Collection. Identical in behavior to Array.flatMap().
Function that produces a new Collection
Checks if all of the elements exist in the collection.
The keys of the elements to check for
true
if all of the elements exist, false
if at least one does not exist.
Checks if any of the elements exist in the collection.
The keys of the elements to check for
true
if any of the elements exist, false
if none exist.
The intersect method returns a new structure containing items where the keys and values are present in both original structures.
The other Collection to filter against
Identical to Array.at(). Returns the key at a given index, allowing for positive and negative integers. Negative integers count back from the last item in the collection.
The index of the key to obtain
Returns an iterable of keys in the map
Obtains the last value(s) in this collection.
A single value if no amount is provided or an array of values, starting from the start if amount is negative
Obtains the last key(s) in this collection.
A single key if no amount is provided or an array of keys, starting from the start if amount is negative
Maps each item to another value into an array. Identical in behavior to Array.map().
Function that produces an element of the new array, taking three arguments
Maps each item to another value into a collection. Identical in behavior to Array.map().
Function that produces an element of the new collection, taking three arguments
Merges two Collections together into a new Collection.
The other Collection to merge with
Function getting the result if the entry only exists in this Collection
Function getting the result if the entry only exists in the other Collection
Function getting the result if the entry exists in both Collections
Partitions the collection into two collections where the first collection contains the items that passed and the second contains the items that failed.
Function used to test (should return a boolean)
Obtains unique random value(s) from this collection.
A single value if no amount is provided or an array of values
Obtains unique random key(s) from this collection.
A single key if no amount is provided or an array
Applies a function to produce a single value. Identical in behavior to Array.reduce().
Function used to reduce, taking four arguments; accumulator
, currentValue
, currentKey
,
and collection
Starting value for the accumulator
Identical to Array.reverse() but returns a Collection instead of an Array.
Adds or updates an element with a specified key and a value
The key of the element to add or update
The value of the element to add or update
Checks if there exists an item that passes a test. Identical in behavior to Array.some().
Function used to test (should return a boolean)
The sort method sorts the items of a collection in place and returns it. The sort is not necessarily stable in Node 10 or older. The default sort order is according to string Unicode code points.
Specifies a function that defines the sort order. If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element.
The sorted method sorts the items of a collection and returns it. The sort is not necessarily stable in Node 10 or older. The default sort order is according to string Unicode code points.
Specifies a function that defines the sort order. If omitted, the collection is sorted according to each character's Unicode code point value, according to the string conversion of each element.
Removes items that satisfy the provided filter function.
Function used to test (should return a boolean)
The number of removed entries
Runs a function on the collection and returns the collection.
Function to execute
Returns an iterable of values in the map
Creates a Collection from a list of entries.
The list of entries
Function to combine an existing entry with a new one
Generated using TypeDoc version 0.22.16, the 9/16/2022 at 1:09:15 AM
A Map that have a limited size and will remove the oldest items once the max size is reached