Merge pull request #5199 from chrootsu/lodash-ary

lodash: added _.ary() method
This commit is contained in:
Masahiro Wakame
2015-08-04 21:25:38 +09:00
2 changed files with 23 additions and 0 deletions
+4
View File
@@ -759,6 +759,10 @@ _.forEach(saves, function (type) {
asyncSave({ 'type': type, 'complete': done });
});
// _.ary
result = <number[]>['6', '8', '10'].map(_.ary<(s: string) => number>(parseInt, 1));
result = <number[]>['6', '8', '10'].map(_(parseInt).ary<(s: string) => number>(1).value());
// _.backflow
var testBackflowSquareFn = (n: number) => n * n;
var testBackflowAddFn = (n: number, m: number) => n + m;
+19
View File
@@ -5149,6 +5149,25 @@ declare module _ {
after(func: Function): LoDashObjectWrapper<Function>;
}
//_.ary
interface LoDashStatic {
/**
* Creates a function that accepts up to n arguments ignoring any additional arguments.
* @param func The function to cap arguments for.
* @param n The arity cap.
* @param guard Enables use as a callback for functions like `_.map`.
* @returns Returns the new function.
*/
ary<TResult extends Function>(func: Function, n?: number, guard?: Object): TResult;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.ary
*/
ary<TResult extends Function>(n?: number, guard?: Object): LoDashObjectWrapper<TResult>;
}
//_.backflow
interface LoDashStatic {
/**