mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Merge pull request #5231 from chrootsu/lodash-spread
lodash: added _.spread() method
This commit is contained in:
commit
ca877eaa36
@ -999,6 +999,14 @@ result = <string>(_.restParam<testRestParamResult, testRestParamFunc>(testRestPa
|
||||
result = <string>(_.restParam<testRestParamResult>(testRestParamFn, 2))('a', 'b', 1, 2, 3);
|
||||
result = <string>(_(testRestParamFn).restParam<testRestParamResult>(2).value())('a', 'b', 1, 2, 3);
|
||||
|
||||
//_.spread
|
||||
var testSpreadFn = (who: string, what: string) => who + ' says ' + what;
|
||||
interface TestSpreadResultFn {
|
||||
(args: string[]): string;
|
||||
}
|
||||
result = <string>(_.spread<TestSpreadResultFn>(testSpreadFn))(['fred', 'hello']);
|
||||
result = <string>(_(testSpreadFn).spread<TestSpreadResultFn>().value())(['fred', 'hello']);
|
||||
|
||||
var throttled = _.throttle(function () { }, 100);
|
||||
jQuery(window).on('scroll', throttled);
|
||||
|
||||
|
||||
19
lodash/lodash.d.ts
vendored
19
lodash/lodash.d.ts
vendored
@ -5708,6 +5708,25 @@ declare module _ {
|
||||
restParam<TResult extends Function>(start?: number): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.spread
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that invokes func with the this binding of the created function and an array of arguments
|
||||
* much like Function#apply.
|
||||
* @param func The function to spread arguments over.
|
||||
* @return Returns the new function.
|
||||
*/
|
||||
spread<TResult extends Function>(func: Function): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.spread
|
||||
*/
|
||||
spread<TResult extends Function>(): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
|
||||
//_.throttle
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user