|
Last change
on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Tests whether at least one entry in a Map satisfies the provided predicate function.
|
|---|
| 3 | *
|
|---|
| 4 | * This function iterates through the entries of the Map and checks if the predicate function
|
|---|
| 5 | * returns true for at least one entry. It returns true if any entry satisfies the predicate,
|
|---|
| 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 at least one entry satisfies the predicate, false otherwise.
|
|---|
| 13 | *
|
|---|
| 14 | * @example
|
|---|
| 15 | * const map = new Map([
|
|---|
| 16 | * ['a', 1],
|
|---|
| 17 | * ['b', 2],
|
|---|
| 18 | * ['c', 3]
|
|---|
| 19 | * ]);
|
|---|
| 20 | * const result = some(map, (value) => value > 2);
|
|---|
| 21 | * // result will be: true
|
|---|
| 22 | *
|
|---|
| 23 | * const result2 = some(map, (value) => value > 5);
|
|---|
| 24 | * // result2 will be: false
|
|---|
| 25 | */
|
|---|
| 26 | declare function some<K, V>(map: Map<K, V>, doesMatch: (value: V, key: K, map: Map<K, V>) => boolean): boolean;
|
|---|
| 27 |
|
|---|
| 28 | export { some };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.