UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

501 lines (220 loc) 6.13 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [rc-js-util](./rc-js-util.md) &gt; [\_Map](./rc-js-util._map.md) ## \_Map class Utilities that apply to `Map`<!-- -->. **Signature:** ```typescript export declare class _Map ``` ## Properties <table><thead><tr><th> Property </th><th> Modifiers </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> [addToSet](./rc-js-util._map.addtoset.md) </td><td> `static` `readonly` </td><td> typeof mapAddToSet </td><td> Used with maps that store sets. Where a set exists for a given key the value will be added to that set, otherwise a new set will be created containing the value. </td></tr> <tr><td> [arrayMap](./rc-js-util._map.arraymap.md) </td><td> `static` `readonly` </td><td> typeof mapArrayMap </td><td> Like `Array.map` but with a `Map` input. Outputs an `Array`<!-- -->. </td></tr> <tr><td> [clearingDeleteFromSet](./rc-js-util._map.clearingdeletefromset.md) </td><td> `static` `readonly` </td><td> typeof mapClearingDeleteFromSet </td><td> Used with maps that store sets. Where a set exists for a given key the value will be removed from that set, if it is empty after removal, then the set is deleted. </td></tr> <tr><td> [concat](./rc-js-util._map.concat.md) </td><td> `static` `readonly` </td><td> typeof mapConcat </td><td> Used with maps that store arrays. Where an array exists for a given key the values will be appended to that array, otherwise a copy of values array will be inserted. </td></tr> <tr><td> [deleteFromSet](./rc-js-util._map.deletefromset.md) </td><td> `static` `readonly` </td><td> typeof mapDeleteFromSet </td><td> Used with maps that store sets. Where a set exists for a given key the value will be removed from that set. </td></tr> <tr><td> [deleteGet](./rc-js-util._map.deleteget.md) </td><td> `static` `readonly` </td><td> typeof mapDeleteGet </td><td> Get the stored value if present, then delete the key. </td></tr> <tr><td> [entriesToArray](./rc-js-util._map.entriestoarray.md) </td><td> `static` `readonly` </td><td> typeof mapEntriesToArray </td><td> Converts a `Map` into an `Array` of its key value pairs. </td></tr> <tr><td> [firstKey](./rc-js-util._map.firstkey.md) </td><td> `static` `readonly` </td><td> typeof mapFirstKey </td><td> Gets the first inserted key in a `Map`<!-- -->. </td></tr> <tr><td> [firstValue](./rc-js-util._map.firstvalue.md) </td><td> `static` `readonly` </td><td> typeof mapFirstValue </td><td> Gets the first inserted value in a `Map`<!-- -->. </td></tr> <tr><td> [initializeGet](./rc-js-util._map.initializeget.md) </td><td> `static` `readonly` </td><td> typeof mapInitializeGet </td><td> Gets the value from a `Map` for a given key, where the value is `undefined` or hasn't been set, the callback's return will be inserted into the `Map` and returned. </td></tr> <tr><td> [intersect](./rc-js-util._map.intersect.md) </td><td> `static` `readonly` </td><td> typeof mapIntersect </td><td> Does not check value equality, only key. Takes items from A. See [mapIntersect()](./rc-js-util.mapintersect.md)<!-- -->. </td></tr> <tr><td> [keysToArray](./rc-js-util._map.keystoarray.md) </td><td> `static` `readonly` </td><td> typeof mapKeysToArray </td><td> Converts a `Map` into an `Array` of its keys. </td></tr> <tr><td> [push](./rc-js-util._map.push.md) </td><td> `static` `readonly` </td><td> typeof mapPush </td><td> Used with maps that store arrays. Where an array exists for a given key the value will be appended to that array, otherwise a new array will be created containing the value. </td></tr> <tr><td> [removeManyFromArray](./rc-js-util._map.removemanyfromarray.md) </td><td> `static` `readonly` </td><td> typeof mapRemoveManyFromArray </td><td> Used with maps that store sets. Where a set exists for a given key the value will be added to that set, otherwise a new set will be created containing the value. </td></tr> <tr><td> [removeOneFromArray](./rc-js-util._map.removeonefromarray.md) </td><td> `static` `readonly` </td><td> typeof mapRemoveOneFromArray </td><td> Used with maps that store arrays. Where an array exists for a given key the value will be removed from that array. </td></tr> <tr><td> [reportingAddToSet](./rc-js-util._map.reportingaddtoset.md) </td><td> `static` `readonly` </td><td> typeof mapReportingAddToSet </td><td> Used with maps that store sets. Where a set exists for a given key the value will be added to that set, otherwise a new set will be created containing the value. </td></tr> <tr><td> [setDifference](./rc-js-util._map.setdifference.md) </td><td> `static` `readonly` </td><td> typeof mapSetDifference </td><td> returns items in A not in B. </td></tr> <tr><td> [symmetricDifference](./rc-js-util._map.symmetricdifference.md) </td><td> `static` `readonly` </td><td> typeof mapSymmetricDifference </td><td> Returns a map with keys in A not in B, and keys in B not in A. </td></tr> <tr><td> [union](./rc-js-util._map.union.md) </td><td> `static` `readonly` </td><td> typeof mapUnion </td><td> Returns a map with keys from both A and B. If both A and B have the same key the value from B will be used. </td></tr> <tr><td> [valuesToArray](./rc-js-util._map.valuestoarray.md) </td><td> `static` `readonly` </td><td> typeof mapValuesToArray </td><td> Converts a `Map` into an `Array` of its values. </td></tr> </tbody></table>