definitions for _.zipObject and alias _.object

This commit is contained in:
Brian Zengel
2013-10-13 19:51:53 -04:00
parent bec8643ba4
commit 9ac529100b
2 changed files with 16 additions and 5 deletions

View File

@@ -126,6 +126,9 @@ result = <IFoodType[]>_.last(foodsType, { 'type': 'vegetable' });
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
result = <number>_.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]);
////////////////////////////////////////////////////////////////////////////////////////
//WHAT'S LEFT
////////////////////////////////////////////////////////////////////////////////////////

18
lodash/lodash.d.ts vendored
View File

@@ -1005,11 +1005,19 @@ declare module _ {
export function zip(...arrays: any[]): any[];
/**
* Converts arrays into objects. Pass either a single list of [key, value] pairs, or a
* list of keys, and a list of values.
* @param keys Key array.
* @param values Value array.
* @return An object containing the `keys` as properties and `values` as the property values.
* 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.
**/
export function zipObject<TResult extends {}>(
keys: List<string>,
values: List<any>): TResult;
/**
* @see _.zipObject
**/
export function object<TResult extends {}>(
keys: List<string>,