diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 13aa9b805..ef5b46c63 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4360,7 +4360,7 @@ module TestInvokeMap { c: 3, d: 4 } - + let result: string[]; result = _.invokeMap(numArray, 'toString'); result = _.invokeMap(numArray, 'toString', 2); @@ -4370,7 +4370,7 @@ module TestInvokeMap { result = _(numArray).invokeMap('toString', 2).value(); result = _(numArray).chain().invokeMap('toString').value(); result = _(numArray).chain().invokeMap('toString', 2).value(); - + result = _.invokeMap(numArray, Number.prototype.toString); result = _.invokeMap(numArray, Number.prototype.toString, 2); result = _.invokeMap(numArray, Number.prototype.toString); @@ -4379,7 +4379,7 @@ module TestInvokeMap { result = _(numArray).invokeMap(Number.prototype.toString, 2).value(); result = _(numArray).chain().invokeMap(Number.prototype.toString).value(); result = _(numArray).chain().invokeMap(Number.prototype.toString, 2).value(); - + result = _.invokeMap(numDict, 'toString'); result = _.invokeMap(numDict, 'toString', 2); result = _.invokeMap(numDict, 'toString'); @@ -4388,7 +4388,7 @@ module TestInvokeMap { result = _(numDict).invokeMap('toString', 2).value(); result = _(numDict).chain().invokeMap('toString').value(); result = _(numDict).chain().invokeMap('toString', 2).value(); - + result = _.invokeMap(numDict, Number.prototype.toString); result = _.invokeMap(numDict, Number.prototype.toString, 2); result = _.invokeMap(numDict, Number.prototype.toString); @@ -9066,47 +9066,6 @@ module TestOmitBy { } } -// _.toPairs -module TestToPairs { - let object: _.Dictionary; - - { - let result: any[][]; - - result = _.toPairs<_.Dictionary>(object); - } - - { - let result: string[][]; - - result = _.toPairs<_.Dictionary, string>(object); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(object).toPairs(); - } - - { - let result: _.LoDashImplicitArrayWrapper; - - result = _(object).toPairs(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(object).chain().toPairs(); - } - - { - let result: _.LoDashExplicitArrayWrapper; - - result = _(object).chain().toPairs(); - } -} - // _.pick module TestPick { let predicate: (element: any, key: string, collection: any) => boolean; @@ -9272,6 +9231,88 @@ module TestSetWith { } } +// _.toPairs +namespace TestToPairs { + let object: _.Dictionary; + + { + let result: any[][]; + + result = _.toPairs<_.Dictionary>(object); + } + + { + let result: string[][]; + + result = _.toPairs<_.Dictionary, string>(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).toPairs(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).toPairs(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().toPairs(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().toPairs(); + } +} + +// _.toPairsIn +namespace TestToPairsIn { + let object: _.Dictionary; + + { + let result: any[][]; + + result = _.toPairsIn<_.Dictionary>(object); + } + + { + let result: string[][]; + + result = _.toPairsIn<_.Dictionary, string>(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).toPairsIn(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).toPairsIn(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().toPairsIn(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().toPairs(); + } +} + // _.transform module TestTransform { let array: number[]; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 7ae72b706..9163c6674 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7904,7 +7904,7 @@ declare module _ { method: (...args: any[]) => TResult, ...args: any[]): TResult[]; } - + interface LoDashImplicitArrayWrapper { /** * @see _.invokeMap @@ -7920,7 +7920,7 @@ declare module _ { method: (...args: any[]) => TResult, ...args: any[]): LoDashImplicitArrayWrapper; } - + interface LoDashImplicitObjectWrapper { /** * @see _.invokeMap @@ -7936,7 +7936,7 @@ declare module _ { method: (...args: any[]) => TResult, ...args: any[]): LoDashImplicitArrayWrapper; } - + interface LoDashExplicitArrayWrapper { /** * @see _.invokeMap @@ -7952,7 +7952,7 @@ declare module _ { method: (...args: any[]) => TResult, ...args: any[]): LoDashExplicitArrayWrapper; } - + interface LoDashExplicitObjectWrapper { /** * @see _.invokeMap @@ -15504,33 +15504,6 @@ declare module _ { ): LoDashExplicitObjectWrapper; } - //_.toPairs - interface LoDashStatic { - /** - * Creates a two dimensional array of the key-value pairs for object, e.g. [[key1, value1], [key2, value2]]. - * - * @param object The object to query. - * @return Returns the new array of key-value pairs. - */ - toPairs(object?: T): any[][]; - - toPairs(object?: T): TResult[][]; - } - - interface LoDashImplicitObjectWrapper { - /** - * @see _.toPairs - */ - toPairs(): LoDashImplicitArrayWrapper; - } - - interface LoDashExplicitObjectWrapper { - /** - * @see _.toPairs - */ - toPairs(): LoDashExplicitArrayWrapper; - } - //_.pick interface LoDashStatic { /** @@ -15803,6 +15776,60 @@ declare module _ { ): LoDashExplicitObjectWrapper; } + //_.toPairs + interface LoDashStatic { + /** + * Creates an array of own enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + toPairs(object?: T): any[][]; + + toPairs(object?: T): TResult[][]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.toPairs + */ + toPairs(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.toPairs + */ + toPairs(): LoDashExplicitArrayWrapper; + } + + //_.toPairsIn + interface LoDashStatic { + /** + * Creates an array of own and inherited enumerable key-value pairs for object. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + toPairsIn(object?: T): any[][]; + + toPairsIn(object?: T): TResult[][]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.toPairsIn + */ + toPairsIn(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.toPairsIn + */ + toPairsIn(): LoDashExplicitArrayWrapper; + } + //_.transform interface LoDashStatic { /**