mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
lodash: added _.rearg() method
This commit is contained in:
@@ -977,6 +977,16 @@ var optionsPartialRight = {
|
||||
|
||||
defaultsDeep(optionsPartialRight, _.templateSettings);
|
||||
|
||||
//_.rearg
|
||||
var testReargFn = (a: string, b: string, c: string) => [a, b, c];
|
||||
interface TestReargResultFn {
|
||||
(b: string, c: string, a: string): string[];
|
||||
}
|
||||
result = <string[]>(_.rearg<TestReargResultFn>(testReargFn, 2, 0, 1))('b', 'c', 'a');
|
||||
result = <string[]>(_.rearg<TestReargResultFn>(testReargFn, [2, 0, 1]))('b', 'c', 'a');
|
||||
result = <string[]>(_(testReargFn).rearg<TestReargResultFn>(2, 0, 1).value())('b', 'c', 'a');
|
||||
result = <string[]>(_(testReargFn).rearg<TestReargResultFn>([2, 0, 1]).value())('b', 'c', 'a');
|
||||
|
||||
//_.restParam
|
||||
var testRestParamFn = (a: string, b: string, c: number[]) => a + ' ' + b + ' ' + c.join(' ');
|
||||
interface testRestParamFunc {
|
||||
|
||||
Vendored
+30
@@ -5654,6 +5654,36 @@ declare module _ {
|
||||
...args: any[]): Function;
|
||||
}
|
||||
|
||||
//_.rearg
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that invokes func with arguments arranged according to the specified indexes where the
|
||||
* argument value at the first index is provided as the first argument, the argument value at the second index
|
||||
* is provided as the second argument, and so on.
|
||||
* @param func The function to rearrange arguments for.
|
||||
* @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes.
|
||||
* @return Returns the new function.
|
||||
*/
|
||||
rearg<TResult extends Function>(func: Function, indexes: number[]): TResult;
|
||||
|
||||
/**
|
||||
* @see _.rearg
|
||||
*/
|
||||
rearg<TResult extends Function>(func: Function, ...indexes: number[]): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.rearg
|
||||
*/
|
||||
rearg<TResult extends Function>(indexes: number[]): LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.rearg
|
||||
*/
|
||||
rearg<TResult extends Function>(...indexes: number[]): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.restParam
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user