mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge pull request #4103 from peferron/zipobject
lodash: update _.zipObject and _.object
This commit is contained in:
@@ -271,8 +271,14 @@ 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]);
|
||||
result = <_.Dictionary<any>>_.zipObject(['moe', 'larry'], [30, 40]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_(['moe', 'larry']).zipObject([30, 40]);
|
||||
result = <_.Dictionary<any>>_.object(['moe', 'larry'], [30, 40]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_(['moe', 'larry']).object([30, 40]);
|
||||
result = <_.Dictionary<any>>_.zipObject([['moe', 30], ['larry', 40]]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_([['moe', 30], ['larry', 40]]).zipObject();
|
||||
result = <_.Dictionary<any>>_.object([['moe', 30], ['larry', 40]]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_([['moe', 30], ['larry', 40]]).object();
|
||||
|
||||
result = <number[]>_.pull([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
|
||||
|
||||
46
lodash/lodash.d.ts
vendored
46
lodash/lodash.d.ts
vendored
@@ -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<TResult extends {}>(
|
||||
keys: List<string>,
|
||||
values: List<any>): TResult;
|
||||
props: List<string>,
|
||||
values?: List<any>): TResult;
|
||||
|
||||
/**
|
||||
* @see _.object
|
||||
* @see _.zipObject
|
||||
**/
|
||||
zipObject<TResult extends {}>(props: List<List<any>>): Dictionary<any>;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
**/
|
||||
object<TResult extends {}>(
|
||||
keys: List<string>,
|
||||
values: List<any>): TResult;
|
||||
}
|
||||
props: List<string>,
|
||||
values?: List<any>): TResult;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
**/
|
||||
object<TResult extends {}>(props: List<List<any>>): Dictionary<any>;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.zipObject
|
||||
**/
|
||||
zipObject(values?: List<any>): _.LoDashObjectWrapper<Dictionary<any>>;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
**/
|
||||
object(values?: List<any>): _.LoDashObjectWrapper<Dictionary<any>>;
|
||||
}
|
||||
|
||||
/* *************
|
||||
* Collections *
|
||||
************* */
|
||||
|
||||
Reference in New Issue
Block a user