|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
947 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Tests whether all elements in a Set satisfy the provided predicate function.
|
|---|
| 3 | *
|
|---|
| 4 | * This function iterates through all elements of the Set and checks if the predicate function
|
|---|
| 5 | * returns true for every element. It returns true if the predicate is satisfied for all elements,
|
|---|
| 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 all elements satisfy the predicate, false otherwise.
|
|---|
| 12 | *
|
|---|
| 13 | * @example
|
|---|
| 14 | * const set = new Set([10, 20, 30]);
|
|---|
| 15 | * const result = every(set, (value) => value > 5);
|
|---|
| 16 | * // result will be: true
|
|---|
| 17 | *
|
|---|
| 18 | * const result2 = every(set, (value) => value > 15);
|
|---|
| 19 | * // result2 will be: false
|
|---|
| 20 | */
|
|---|
| 21 | declare function every<T>(set: Set<T>, doesMatch: (value: T, value2: T, set: Set<T>) => boolean): boolean;
|
|---|
| 22 |
|
|---|
| 23 | export { every };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.