RaidenCol
RaidenCol ⇐ Map
Section titled “RaidenCol ⇐ Map”Kind: global class
Extends: Map
- RaidenCol ⇐
Map- new RaidenCol()
- instance
- .size ⇒
number - .map(fn) ⇒
Array - .mapVal(fn) ⇒
Array - .first() ⇒
any|undefined - .find(fn) ⇒
- .filter(fn) ⇒
Object - .filterKey(fn) ⇒
- .last() ⇒
any - .lastKey() ⇒
- .tap(fn) ⇒
Object - .has(k) ⇒
boolean - .array() ⇒
Array - .keyArray() ⇒
Array - .hasAll(…c) ⇒
boolean - .hasAny(…keys) ⇒
boolean - .some(fn) ⇒
boolean - .random() ⇒
- .get(k) ⇒
- .every(fn) ⇒
boolean - .each(fn) ⇒
Array - .randomKey() ⇒
- .equals(collection) ⇒
boolean - .difference(collection) ⇒
Array - .findKey(fn) ⇒
- .sort([fn]) ⇒
RaidenCol - .clear() ⇒
void - .at([index]) ⇒
- .size ⇒
- static
- .compareFunction(one, two) ⇒
number
- .compareFunction(one, two) ⇒
new RaidenCol()
Section titled “new RaidenCol()”A custom implementation of a Map with additional utility methods.
raidenCol.size ⇒ number
Section titled “raidenCol.size ⇒ number”Get the size of the Map object.
Kind: instance property of RaidenCol
Returns: number - The number of key-value pairs in the Map object.
raidenCol.map(fn) ⇒ Array
Section titled “raidenCol.map(fn) ⇒ Array”Maps over the elements of the Map object and applies a function to each element.
Kind: instance method of RaidenCol
Returns: Array - - An array containing the results of applying the function to each element.
| Param | Type | Description |
|---|---|---|
| fn | function | The function to apply to each element. |
raidenCol.mapVal(fn) ⇒ Array
Section titled “raidenCol.mapVal(fn) ⇒ Array”Maps each value in the Map object using the provided function and returns an array of the mapped values.
Kind: instance method of RaidenCol
Returns: Array - - An array of the mapped values.
| Param | Type | Description |
|---|---|---|
| fn | function | The function to apply to each value in the Map object. |
raidenCol.first() ⇒ any | undefined
Section titled “raidenCol.first() ⇒ any | undefined”Returns the first element in the collection.
Kind: instance method of RaidenCol
Returns: any | undefined - The first element in the collection, or undefined if the collection is empty.
raidenCol.find(fn) ⇒
Section titled “raidenCol.find(fn) ⇒”Finds the first value in the Map that satisfies the provided testing function.
Kind: instance method of RaidenCol
Returns: The first value that satisfies the condition, or undefined if no value satisfies the condition.
| Param | Type | Description |
|---|---|---|
| fn | function | The testing function. It should return true if the value satisfies the condition, false otherwise. |
raidenCol.filter(fn) ⇒ Object
Section titled “raidenCol.filter(fn) ⇒ Object”Creates a new instance of the same class and returns a filtered version of the current instance.
Kind: instance method of RaidenCol
Returns: Object - - A new instance of the same class with the filtered values.
| Param | Type | Description |
|---|---|---|
| fn | function | The filter function to apply to each value in the instance. |
raidenCol.filterKey(fn) ⇒
Section titled “raidenCol.filterKey(fn) ⇒”Filters the key-value pairs of a Map object based on a given function.
Kind: instance method of RaidenCol
Returns: A new Map object containing the filtered key-value pairs.
| Param | Type | Description |
|---|---|---|
| fn | function | The function used to filter the keys. |
raidenCol.last() ⇒ any
Section titled “raidenCol.last() ⇒ any”Returns the last element in the set.
Kind: instance method of RaidenCol
Returns: any - The last element in the set, or undefined if the set is empty.
raidenCol.lastKey() ⇒
Section titled “raidenCol.lastKey() ⇒”Returns the last key in the keyArray.
Kind: instance method of RaidenCol
Returns: The last key in the keyArray.
raidenCol.tap(fn) ⇒ Object
Section titled “raidenCol.tap(fn) ⇒ Object”Executes a function with the current object as its argument and returns the object itself.
Kind: instance method of RaidenCol
Returns: Object - - The current object.
| Param | Type | Description |
|---|---|---|
| fn | function | The function to be executed. |
raidenCol.has(k) ⇒ boolean
Section titled “raidenCol.has(k) ⇒ boolean”Checks if the specified key is present in the Map object.
Kind: instance method of RaidenCol
Returns: boolean - - True if the key is present, false otherwise.
| Param | Type | Description |
|---|---|---|
| k | any | The key to check for. |
raidenCol.array() ⇒ Array
Section titled “raidenCol.array() ⇒ Array”Returns an array containing all the values of the current object.
Kind: instance method of RaidenCol
Returns: Array - - An array containing all the values of the object.
raidenCol.keyArray() ⇒ Array
Section titled “raidenCol.keyArray() ⇒ Array”Returns an array containing all the keys in the Map object.
Kind: instance method of RaidenCol
Returns: Array - An array containing all the keys in the Map object.
raidenCol.hasAll(…c) ⇒ boolean
Section titled “raidenCol.hasAll(…c) ⇒ boolean”Checks if all the given elements are present in the set.
Kind: instance method of RaidenCol
Returns: boolean - - True if all elements are present, false otherwise.
| Param | Type | Description |
|---|---|---|
| …c | any | The elements to check for presence in the set. |
raidenCol.hasAny(…keys) ⇒ boolean
Section titled “raidenCol.hasAny(…keys) ⇒ boolean”Checks if any of the given keys exist in the Map.
Kind: instance method of RaidenCol
Returns: boolean - - True if any of the keys exist in the Map, false otherwise.
| Param | Type | Description |
|---|---|---|
| …keys | any | The keys to check for existence in the Map. |
raidenCol.some(fn) ⇒ boolean
Section titled “raidenCol.some(fn) ⇒ boolean”Checks if any key-value pair in the Map satisfies the given condition.
Kind: instance method of RaidenCol
Returns: boolean - True if any key-value pair satisfies the condition, false otherwise.
| Param | Type | Description |
|---|---|---|
| fn | function | The condition function to be applied to each key-value pair. It should take two arguments: key and value. |
raidenCol.random() ⇒
Section titled “raidenCol.random() ⇒”Returns a random element from the Set.
Kind: instance method of RaidenCol
Returns: A random element from the Set.
raidenCol.get(k) ⇒
Section titled “raidenCol.get(k) ⇒”Retrieves the value associated with the specified key from the Map object.
Kind: instance method of RaidenCol
Returns: The value associated with the specified key, or undefined if the key does not exist in the Map.
| Param | Type | Description |
|---|---|---|
| k | any | The key of the element to retrieve. |
raidenCol.every(fn) ⇒ boolean
Section titled “raidenCol.every(fn) ⇒ boolean”Checks if every element in the collection satisfies the provided testing function.
Kind: instance method of RaidenCol
Returns: boolean - - True if every element passes the test, false otherwise.
| Param | Type | Description |
|---|---|---|
| fn | function | The testing function to apply to each element. It should return a boolean value indicating whether the element passes the test. The function is invoked with two arguments: the element value and the element key. |
raidenCol.each(fn) ⇒ Array
Section titled “raidenCol.each(fn) ⇒ Array”Executes a provided function once for each element in the array.
Kind: instance method of RaidenCol
Returns: Array - - The modified array.
| Param | Type | Description |
|---|---|---|
| fn | function | The function to execute for each element. |
raidenCol.randomKey() ⇒
Section titled “raidenCol.randomKey() ⇒”Generates a random key from the Set object.
Kind: instance method of RaidenCol
Returns: A random key from the Set object.
raidenCol.equals(collection) ⇒ boolean
Section titled “raidenCol.equals(collection) ⇒ boolean”Checks if the current collection is equal to the given collection.
Kind: instance method of RaidenCol
Returns: boolean - True if the collections are equal, false otherwise.
| Param | Type | Description |
|---|---|---|
| collection | Collection | The collection to compare with. |
raidenCol.difference(collection) ⇒ Array
Section titled “raidenCol.difference(collection) ⇒ Array”Calculates the difference between this Set and another collection.
Kind: instance method of RaidenCol
Returns: Array - - An array of values that are present in the other collection but not in this Set.
If the sizes of the two collections are different, returns a string indicating the size difference.
| Param | Type | Description |
|---|---|---|
| collection | Collection | The collection to compare against. |
raidenCol.findKey(fn) ⇒
Section titled “raidenCol.findKey(fn) ⇒”Finds the key in the Map object that satisfies the given function.
Kind: instance method of RaidenCol
Returns: The key that satisfies the function, or the Map object if no key is found.
| Param | Type | Description |
|---|---|---|
| fn | function | The function to test each key-value pair of the Map object. |
raidenCol.sort([fn]) ⇒ RaidenCol
Section titled “raidenCol.sort([fn]) ⇒ RaidenCol”Sorts the entries in the RaidenCol object based on the provided compare function or the default compare function.
Kind: instance method of RaidenCol
Returns: RaidenCol - - The sorted RaidenCol object.
| Param | Type | Default | Description |
|---|---|---|---|
| [fn] | function | RaidenCol.compareFunction | The compare function used to determine the order of the entries. If not provided, the default compare function of the RaidenCol object will be used. |
raidenCol.clear() ⇒ void
Section titled “raidenCol.clear() ⇒ void”Clears the current state of the object by calling the clear method of the superclass.
Kind: instance method of RaidenCol
raidenCol.at([index]) ⇒
Section titled “raidenCol.at([index]) ⇒”Retrieves the element at the specified index from the collection.
Kind: instance method of RaidenCol
Returns: The element at the specified index.
| Param | Type | Default | Description |
|---|---|---|---|
| [index] | number | 0 | The index of the element to retrieve. Defaults to 0 if not provided. |
RaidenCol.compareFunction(one, two) ⇒ number
Section titled “RaidenCol.compareFunction(one, two) ⇒ number”Compare two values and return a number indicating their relative order.
Kind: static method of RaidenCol
Returns: number - - A number indicating the relative order of the values:
-1 if one is less than two,
0 if one is equal to two,
1 if one is greater than two.
| Param | Type | Description |
|---|---|---|
| one | any | The first value to compare. |
| two | any | The second value to compare. |