Private constructorStatic deleteStatic filterReturn a new map with entries that pass the provided predicate function.
a new map with the entries that pass the test; if no entries pass, an empty map is returned
https://github.com/tc39/proposal-collection-methods
Static findReturn a value found in the map that satisfies the predicate, or null if none is found.
the value found, or null if none is found
https://github.com/tc39/proposal-collection-methods
Static findReturn a key found in the map that satisfies the predicate, or null if none is found.
the key found, or null if none is found
https://github.com/tc39/proposal-collection-methods
Static forPerform a callback function on a map, aggregating any errors caught.
Instead of throwing on the first error and stopping iteration, as Map#forEach would do, this method continues performing the callback on the rest of the map until all items are done. If only one error was caught, then that error is simply rethrown. However, if more errors were caught, they are collected into a single AggregateError, which is then thrown. If no errors are caught, this method returns void.
xjs.Map.forEachAggregated<number>(new Map<string, number>([
['one', 1],
['two', 2],
['three', 3],
['four', 4],
]), (num, name) => {
if (num % 2 === 0) {
throw new Error(`${ name } is even.`);
};
});
// Expected thrown error:
AggregateError {
errors: [
Error { message: "two is even." },
Error { message: "four is even." },
]
}
K the type of keys in the map
V the type of values in the map
if two or more iterations throws an error
if one iteration throws an error
Static getStatic hasStatic isTest whether two maps have “the same” key–value pairs.
Similar to xjs_Set.is, where the order is not important, but also has the option to check equality of keys.
the first map
the second map
for checking equality for keys/values
Optional keys?: ((x, y) => boolean)check the “sameness” of corresponding keys of a and b
Optional values?: ((x, y) => boolean)check the “sameness” of corresponding values of a and b
Are corresponding pairs the same, i.e. replaceable?
K - the type of keys in the maps
V - the type of values in the maps
Static mapReturn a new Map with the results of calling a provided function on every key in the given Map.
a new Map with transformed keys obtained from callback and the same values
https://github.com/tc39/proposal-collection-methods
Static mapReturn a new Map with the results of calling a provided function on every value in the given Map.
a new Map with the same keys and transformed values obtained from callback
https://github.com/tc39/proposal-collection-methods
Static setStatic tee
Additional static members for the native Map class.
Does not extend the native Map class.