|
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:
958 bytes
|
| Rev | Line | |
|---|
| [a762898] | 1 | /**
|
|---|
| 2 | * Tests whether at least one element in a Set satisfies the provided predicate function.
|
|---|
| 3 | *
|
|---|
| 4 | * This function iterates through the elements of the Set and checks if the predicate function
|
|---|
| 5 | * returns true for at least one element. It returns true if any element satisfies the predicate,
|
|---|
| 6 | * and false otherwise.
|
|---|
| 7 | *
|
|---|
| 8 | * @template T - The type of elements in the Set.
|
|---|
| 9 | * @param {Set<T>} set - The Set to test.
|
|---|
| 10 | * @param {(value: T, value2: T, set: Set<T>) => boolean} doesMatch - A predicate function that tests each element.
|
|---|
| 11 | * @returns {boolean} true if at least one element satisfies the predicate, false otherwise.
|
|---|
| 12 | *
|
|---|
| 13 | * @example
|
|---|
| 14 | * const set = new Set([1, 2, 3]);
|
|---|
| 15 | * const result = some(set, (value) => value > 2);
|
|---|
| 16 | * // result will be: true
|
|---|
| 17 | *
|
|---|
| 18 | * const result2 = some(set, (value) => value > 5);
|
|---|
| 19 | * // result2 will be: false
|
|---|
| 20 | */
|
|---|
| 21 | declare function some<T>(set: Set<T>, doesMatch: (value: T, value2: T, set: Set<T>) => boolean): boolean;
|
|---|
| 22 |
|
|---|
| 23 | export { some };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.