|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Rev | Line | |
|---|
| [a762898] | 1 | /**
|
|---|
| 2 | * Tests whether all entries in a Map satisfy the provided predicate function.
|
|---|
| 3 | *
|
|---|
| 4 | * This function iterates through all entries of the Map and checks if the predicate function
|
|---|
| 5 | * returns true for every entry. It returns true if the predicate is satisfied for all entries,
|
|---|
| 6 | * and false otherwise.
|
|---|
| 7 | *
|
|---|
| 8 | * @template K - The type of keys in the Map.
|
|---|
| 9 | * @template V - The type of values in the Map.
|
|---|
| 10 | * @param {Map<K, V>} map - The Map to test.
|
|---|
| 11 | * @param {(value: V, key: K, map: Map<K, V>) => boolean} doesMatch - A predicate function that tests each entry.
|
|---|
| 12 | * @returns {boolean} true if all entries satisfy the predicate, false otherwise.
|
|---|
| 13 | *
|
|---|
| 14 | * @example
|
|---|
| 15 | * const map = new Map([
|
|---|
| 16 | * ['a', 10],
|
|---|
| 17 | * ['b', 20],
|
|---|
| 18 | * ['c', 30]
|
|---|
| 19 | * ]);
|
|---|
| 20 | * const result = every(map, (value) => value > 5);
|
|---|
| 21 | * // result will be: true
|
|---|
| 22 | *
|
|---|
| 23 | * const result2 = every(map, (value) => value > 15);
|
|---|
| 24 | * // result2 will be: false
|
|---|
| 25 | */
|
|---|
| 26 | declare function every<K, V>(map: Map<K, V>, doesMatch: (value: V, key: K, map: Map<K, V>) => boolean): boolean;
|
|---|
| 27 |
|
|---|
| 28 | export { every };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.