@newdash/newdash
Version:
javascript/typescript utility library
31 lines (30 loc) • 624 B
TypeScript
/**
* Creates a function that invokes `func` with its arguments transformed.
*
* @since 5.11.0
* @category Function
* @param func The function to wrap.
* @param transforms The argument transforms.
* @returns Returns the new function.
* @example
*
* ```js
* function doubled(n) {
* return n * 2
* }
*
* function square(n) {
* return n * n
* }
*
* const func = overArgs((x, y) => [x, y], [square, doubled])
*
* func(9, 3)
* // => [81, 6]
*
* func(10, 5)
* // => [100, 10]
* ```
*/
export declare function overArgs(func: Function, transforms: Array<Function>): Function;
export default overArgs;