From a8115c9191d174fa978f89c40470ffa886f04ab0 Mon Sep 17 00:00:00 2001 From: Santi Albo Date: Mon, 10 Mar 2014 18:46:25 +0000 Subject: [PATCH 1/4] Add missing _.mapValues type definition --- lodash/lodash.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b48f7e6034..1fda4516e3 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3457,6 +3457,18 @@ declare module _ { keys(object: any): string[]; } + //_.mapValues + interface LodashStatic { + mapValues( + object: any, + callback: ObjectIterator, + thisArg?: any): Mapped; + + mapValues( + object: any, + pluckValue: string): Mapped; + } + //_.merge interface LoDashStatic { /** From ff75f784e1b47dc999a7fe242823869f3b66989d Mon Sep 17 00:00:00 2001 From: Santi Albo Date: Mon, 10 Mar 2014 18:56:46 +0000 Subject: [PATCH 2/4] Add method documentation --- lodash/lodash.d.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 1fda4516e3..fc50a0cb2e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3458,7 +3458,23 @@ declare module _ { } //_.mapValues - interface LodashStatic { + interface LoDashStatic { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through the callback. The callback is bound to thisArg and + * invoked with three arguments; (value, key, object). + * + * If a property name is provided for callback the created "_.pluck" style callback will return + * the property value of the given element. + * + * If an object is provided for callback the created "_.where" style callback will return true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param callback The function called per iteration. + * @param thisArg `this` object in `iterator`, optional. + * @return Returns a new object with values of the results of each callback execution. + */ mapValues( object: any, callback: ObjectIterator, From 00aec5744b668f60661d987c3795e62a52180cd1 Mon Sep 17 00:00:00 2001 From: Santi Albo Date: Mon, 10 Mar 2014 18:59:36 +0000 Subject: [PATCH 3/4] Use tabs instead of spaces, like the rest of the file --- lodash/lodash.d.ts | 52 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index fc50a0cb2e..dac7a26ed2 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3457,33 +3457,33 @@ declare module _ { keys(object: any): string[]; } - //_.mapValues - interface LoDashStatic { - /** - * Creates an object with the same keys as object and values generated by running each own - * enumerable property of object through the callback. The callback is bound to thisArg and - * invoked with three arguments; (value, key, object). - * - * If a property name is provided for callback the created "_.pluck" style callback will return - * the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return true - * for elements that have the properties of the given object, else false. - * - * @param object The object to iterate over. - * @param callback The function called per iteration. - * @param thisArg `this` object in `iterator`, optional. - * @return Returns a new object with values of the results of each callback execution. - */ - mapValues( - object: any, - callback: ObjectIterator, - thisArg?: any): Mapped; + //_.mapValues + interface LoDashStatic { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through the callback. The callback is bound to thisArg and + * invoked with three arguments; (value, key, object). + * + * If a property name is provided for callback the created "_.pluck" style callback will return + * the property value of the given element. + * + * If an object is provided for callback the created "_.where" style callback will return true + * for elements that have the properties of the given object, else false. + * + * @param object The object to iterate over. + * @param callback The function called per iteration. + * @param thisArg `this` object in `iterator`, optional. + * @return Returns a new object with values of the results of each callback execution. + */ + mapValues( + object: any, + callback: ObjectIterator, + thisArg?: any): Mapped; - mapValues( - object: any, - pluckValue: string): Mapped; - } + mapValues( + object: any, + pluckValue: string): Mapped; + } //_.merge interface LoDashStatic { From dca457aa7193072d75c295e974e53228739756fc Mon Sep 17 00:00:00 2001 From: Santi Albo Date: Tue, 11 Mar 2014 10:12:49 +0000 Subject: [PATCH 4/4] Use generic parameter --- lodash/lodash.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index dac7a26ed2..9f186f4336 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3476,12 +3476,12 @@ declare module _ { * @return Returns a new object with values of the results of each callback execution. */ mapValues( - object: any, + object: T, callback: ObjectIterator, thisArg?: any): Mapped; mapValues( - object: any, + object: T, pluckValue: string): Mapped; }