mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #5073 from chrootsu/lodash-modArgs
lodash: added _.modArgs() method
This commit is contained in:
@@ -857,6 +857,27 @@ stooge('curly');
|
||||
var returnedMemoize = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedMemoize(4);
|
||||
|
||||
// _.modArgs
|
||||
function modArgsFn1(n: number): string {return n.toString()}
|
||||
function modArgsFn2(n: boolean): string {return n.toString()}
|
||||
interface ModArgsFunc {
|
||||
(x: string, y: string): string[];
|
||||
}
|
||||
interface ModArgsResult {
|
||||
(x: number, y: boolean): string[]
|
||||
}
|
||||
result = <ModArgsResult>_.modArgs<ModArgsFunc, ModArgsResult>((x: string, y: string) => [x, y], modArgsFn1, modArgsFn2);
|
||||
result = <string[]>result(1, true);
|
||||
|
||||
result = <ModArgsResult>_.modArgs<ModArgsFunc, ModArgsResult>((x: string, y: string) => [x, y], [modArgsFn1, modArgsFn2]);
|
||||
result = <string[]>result(1, true);
|
||||
|
||||
result = <ModArgsResult>_<ModArgsFunc>((x: string, y: string) => [x, y]).modArgs<ModArgsResult>(modArgsFn1, modArgsFn2).value();
|
||||
result = <string[]>result(1, true);
|
||||
|
||||
result = <ModArgsResult>_<ModArgsFunc>((x: string, y: string) => [x, y]).modArgs<ModArgsResult>([modArgsFn1, modArgsFn2]).value();
|
||||
result = <string[]>result(1, true);
|
||||
|
||||
var initialize = _.once(function () { });
|
||||
initialize();
|
||||
initialize();''
|
||||
|
||||
Vendored
+35
@@ -5386,6 +5386,41 @@ declare module _ {
|
||||
resolver?: Function): T;
|
||||
}
|
||||
|
||||
//_.modArgs
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that runs each argument through a corresponding transform function.
|
||||
* @param func The function to wrap.
|
||||
* @param transforms The functions to transform arguments, specified as individual functions or arrays
|
||||
* of functions.
|
||||
* @return Returns the new function.
|
||||
*/
|
||||
modArgs<T extends Function, TResult extends Function>(
|
||||
func: T,
|
||||
...transforms: Function[]
|
||||
): TResult;
|
||||
|
||||
/**
|
||||
* @see _.modArgs
|
||||
*/
|
||||
modArgs<T extends Function, TResult extends Function>(
|
||||
func: T,
|
||||
transforms: Function[]
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.modArgs
|
||||
*/
|
||||
modArgs<TResult>(...transforms: Function[]): LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.modArgs
|
||||
*/
|
||||
modArgs<TResult>(transforms: Function[]): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.once
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user