|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
541 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Creates a function that negates the result of the predicate function.
|
|---|
| 3 | *
|
|---|
| 4 | * @template F - The type of the function to negate.
|
|---|
| 5 | * @param {F} func - The function to negate.
|
|---|
| 6 | * @returns {F} The new negated function, which negates the boolean result of `func`.
|
|---|
| 7 | *
|
|---|
| 8 | * @example
|
|---|
| 9 | * const array = [1, 2, 3, 4, 5, 6];
|
|---|
| 10 | * const isEven = (n: number) => n % 2 === 0;
|
|---|
| 11 | * const result = array.filter(negate(isEven));
|
|---|
| 12 | * // result will be [1, 3, 5]
|
|---|
| 13 | */
|
|---|
| 14 | declare function negate<F extends (...args: any[]) => boolean>(func: F): F;
|
|---|
| 15 |
|
|---|
| 16 | export { negate };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.