diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 3caeec9f53..6a48e20c16 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -271,8 +271,14 @@ result = _.last(foodsType, { 'type': 'vegetable' }); result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); -result = <{ [key: string]: any }>_.zipObject(['moe', 'larry'], [30, 40]); -result = <{ [key: string]: any }>_.object(['moe', 'larry'], [30, 40]); +result = <_.Dictionary>_.zipObject(['moe', 'larry'], [30, 40]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_(['moe', 'larry']).zipObject([30, 40]); +result = <_.Dictionary>_.object(['moe', 'larry'], [30, 40]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_(['moe', 'larry']).object([30, 40]); +result = <_.Dictionary>_.zipObject([['moe', 30], ['larry', 40]]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_([['moe', 30], ['larry', 40]]).zipObject(); +result = <_.Dictionary>_.object([['moe', 30], ['larry', 40]]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_([['moe', 30], ['larry', 40]]).object(); result = _.pull([1, 2, 3, 1, 2, 3], 2, 3); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 92ed24ef93..602b05d311 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2069,25 +2069,47 @@ declare module _ { //_.zipObject interface LoDashStatic { /** - * Creates an object composed from arrays of keys and values. Provide either a single - * two dimensional array, i.e. [[key1, value1], [key2, value2]] or two arrays, one of - * keys and one of corresponding values. - * @param keys The array of keys. - * @param values The array of values. - * @return An object composed of the given keys and corresponding values. + * The inverse of _.pairs; this method returns an object composed from arrays of property + * names and values. Provide either a single two dimensional array, e.g. [[key1, value1], + * [key2, value2]] or two arrays, one of property names and one of corresponding values. + * @param props The property names. + * @param values The property values. + * @return Returns the new object. **/ zipObject( - keys: List, - values: List): TResult; + props: List, + values?: List): TResult; /** - * @see _.object + * @see _.zipObject + **/ + zipObject(props: List>): Dictionary; + + /** + * @see _.zipObject **/ object( - keys: List, - values: List): TResult; - } + props: List, + values?: List): TResult; + /** + * @see _.zipObject + **/ + object(props: List>): Dictionary; + } + + interface LoDashArrayWrapper { + /** + * @see _.zipObject + **/ + zipObject(values?: List): _.LoDashObjectWrapper>; + + /** + * @see _.zipObject + **/ + object(values?: List): _.LoDashObjectWrapper>; + } + /* ************* * Collections * ************* */