|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
864 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Creates a function that invokes given functions and returns their results as an array.
|
|---|
| 3 | *
|
|---|
| 4 | * @param {Array<Iteratee | Iteratee[]>} iteratees - The iteratees to invoke.
|
|---|
| 5 | * @returns {(...args: any[]) => unknown[]} Returns the new function.
|
|---|
| 6 | *
|
|---|
| 7 | * @example
|
|---|
| 8 | * const func = over([Math.max, Math.min]);
|
|---|
| 9 | * const func2 = over(Math.max, Math.min); // same as above
|
|---|
| 10 | * func(1, 2, 3, 4);
|
|---|
| 11 | * // => [4, 1]
|
|---|
| 12 | * func2(1, 2, 3, 4);
|
|---|
| 13 | * // => [4, 1]
|
|---|
| 14 | *
|
|---|
| 15 | * const func = over(['a', 'b']);
|
|---|
| 16 | * func({ a: 1, b: 2 });
|
|---|
| 17 | * // => [1, 2]
|
|---|
| 18 | *
|
|---|
| 19 | * const func = over([{ a: 1 }, { b: 2 }]);
|
|---|
| 20 | * func({ a: 1, b: 2 });
|
|---|
| 21 | * // => [true, false]
|
|---|
| 22 | *
|
|---|
| 23 | * const func = over([['a', 1], ['b', 2]]);
|
|---|
| 24 | * func({ a: 1, b: 2 });
|
|---|
| 25 | * // => [true, true]
|
|---|
| 26 | */
|
|---|
| 27 | declare function over<T>(...iteratees: Array<((...args: any[]) => T) | ReadonlyArray<(...args: any[]) => T>>): (...args: any[]) => T[];
|
|---|
| 28 |
|
|---|
| 29 | export { over };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.