From 251aea132302e2f71ee2df6defaf772066bf3edf Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 27 Jan 2016 10:54:56 +0500 Subject: [PATCH] lodash: _.nthArg added --- lodash/lodash-tests.ts | 23 +++++++++++++++++++++++ lodash/lodash.d.ts | 25 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index a7d3a72b88..784d417173 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9881,6 +9881,29 @@ module TestNoop { } } +namespace TestNthArg { + type SampleFunc = (...args: any[]) => any; + + { + let result: SampleFunc; + + result = _.nthArg(); + result = _.nthArg(1); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(1).nthArg(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(1).chain().nthArg(); + } +} + // _.over namespace TestOver { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e5f938b546..f8afeac112 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -16195,6 +16195,31 @@ declare module _ { noop(...args: any[]): _.LoDashExplicitWrapper; } + //_.nthArg + interface LoDashStatic { + /** + * Creates a function that returns its nth argument. + * + * @param n The index of the argument to return. + * @return Returns the new function. + */ + nthArg(n?: number): TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.nthArg + */ + nthArg(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.nthArg + */ + nthArg(): LoDashExplicitObjectWrapper; + } + //_.over interface LoDashStatic { /**