mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-29 11:12:23 +08:00
lodash: changed signatures of the method _.zipObject (and alias _.object)
This commit is contained in:
+126
-9
@@ -488,6 +488,69 @@ module TestLastIndexOf {
|
||||
result = _(list).lastIndexOf<TResult>(value, 42);
|
||||
}
|
||||
|
||||
// _.object
|
||||
module TestObject {
|
||||
let arrayOfKeys: string[];
|
||||
let arrayOfValues: number[];
|
||||
|
||||
let listOfKeys: _.List<string>;
|
||||
let listOfValues: _.List<number>;
|
||||
|
||||
{
|
||||
let result: _.Dictionary<void>;
|
||||
|
||||
result = _.object<_.Dictionary<void>>(arrayOfKeys);
|
||||
result = _.object<_.Dictionary<void>>(listOfKeys);
|
||||
|
||||
result = _(arrayOfKeys).object<_.Dictionary<void>>().value();
|
||||
result = _(listOfKeys).object<_.Dictionary<void>>().value();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.Dictionary<number>;
|
||||
|
||||
result = _.object<_.Dictionary<number>>(arrayOfKeys, arrayOfValues);
|
||||
result = _.object<_.Dictionary<number>>(arrayOfKeys, listOfValues);
|
||||
result = _.object<_.Dictionary<number>>(listOfKeys, listOfValues);
|
||||
result = _.object<_.Dictionary<number>>(listOfKeys, arrayOfValues);
|
||||
|
||||
result = _.object<number, _.Dictionary<number>>(arrayOfKeys, arrayOfValues);
|
||||
result = _.object<number, _.Dictionary<number>>(arrayOfKeys, listOfValues);
|
||||
result = _.object<number, _.Dictionary<number>>(listOfKeys, listOfValues);
|
||||
result = _.object<number, _.Dictionary<number>>(listOfKeys, arrayOfValues);
|
||||
|
||||
result = _(arrayOfKeys).object<_.Dictionary<number>>(arrayOfValues).value();
|
||||
result = _(arrayOfKeys).object<_.Dictionary<number>>(listOfValues).value();
|
||||
result = _(listOfKeys).object<_.Dictionary<number>>(listOfValues).value();
|
||||
result = _(listOfKeys).object<_.Dictionary<number>>(arrayOfValues).value();
|
||||
|
||||
result = _(arrayOfKeys).object<number, _.Dictionary<number>>(arrayOfValues).value();
|
||||
result = _(arrayOfKeys).object<number, _.Dictionary<number>>(listOfValues).value();
|
||||
result = _(listOfKeys).object<number, _.Dictionary<number>>(listOfValues).value();
|
||||
result = _(listOfKeys).object<number, _.Dictionary<number>>(arrayOfValues).value();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.Dictionary<any>;
|
||||
|
||||
result = _.object(arrayOfKeys);
|
||||
result = _.object(arrayOfKeys, arrayOfValues);
|
||||
result = _.object(arrayOfKeys, listOfValues);
|
||||
|
||||
result = _.object(listOfKeys);
|
||||
result = _.object(listOfKeys, listOfValues);
|
||||
result = _.object(listOfKeys, arrayOfValues);
|
||||
|
||||
result = _(arrayOfKeys).object().value();
|
||||
result = _(arrayOfKeys).object(arrayOfValues).value();
|
||||
result = _(arrayOfKeys).object(listOfValues).value();
|
||||
|
||||
result = _(listOfKeys).object().value();
|
||||
result = _(listOfKeys).object(listOfValues).value();
|
||||
result = _(listOfKeys).object(arrayOfValues).value();
|
||||
}
|
||||
}
|
||||
|
||||
// _.pull
|
||||
{
|
||||
let testPullArray: TResult[];
|
||||
@@ -539,15 +602,6 @@ module TestLastIndexOf {
|
||||
result = _(testPullAtList).pullAt<TResult>(4, [2, 3], 1).value();
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
// _.remove
|
||||
module TestRemove {
|
||||
let array: TResult[];
|
||||
@@ -817,6 +871,69 @@ result = <any[][]>_.unzip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
result = <any[][]>_(['moe', 'larry']).zip([30, 40], [true, false]).value();
|
||||
result = <any[][]>_(['moe', 'larry']).unzip([30, 40], [true, false]).value();
|
||||
|
||||
// _.zipObject
|
||||
module TestZipObject {
|
||||
let arrayOfKeys: string[];
|
||||
let arrayOfValues: number[];
|
||||
|
||||
let listOfKeys: _.List<string>;
|
||||
let listOfValues: _.List<number>;
|
||||
|
||||
{
|
||||
let result: _.Dictionary<void>;
|
||||
|
||||
result = _.zipObject<_.Dictionary<void>>(arrayOfKeys);
|
||||
result = _.zipObject<_.Dictionary<void>>(listOfKeys);
|
||||
|
||||
result = _(arrayOfKeys).zipObject<_.Dictionary<void>>().value();
|
||||
result = _(listOfKeys).zipObject<_.Dictionary<void>>().value();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.Dictionary<number>;
|
||||
|
||||
result = _.zipObject<_.Dictionary<number>>(arrayOfKeys, arrayOfValues);
|
||||
result = _.zipObject<_.Dictionary<number>>(arrayOfKeys, listOfValues);
|
||||
result = _.zipObject<_.Dictionary<number>>(listOfKeys, listOfValues);
|
||||
result = _.zipObject<_.Dictionary<number>>(listOfKeys, arrayOfValues);
|
||||
|
||||
result = _.zipObject<number, _.Dictionary<number>>(arrayOfKeys, arrayOfValues);
|
||||
result = _.zipObject<number, _.Dictionary<number>>(arrayOfKeys, listOfValues);
|
||||
result = _.zipObject<number, _.Dictionary<number>>(listOfKeys, listOfValues);
|
||||
result = _.zipObject<number, _.Dictionary<number>>(listOfKeys, arrayOfValues);
|
||||
|
||||
result = _(arrayOfKeys).zipObject<_.Dictionary<number>>(arrayOfValues).value();
|
||||
result = _(arrayOfKeys).zipObject<_.Dictionary<number>>(listOfValues).value();
|
||||
result = _(listOfKeys).zipObject<_.Dictionary<number>>(listOfValues).value();
|
||||
result = _(listOfKeys).zipObject<_.Dictionary<number>>(arrayOfValues).value();
|
||||
|
||||
result = _(arrayOfKeys).zipObject<number, _.Dictionary<number>>(arrayOfValues).value();
|
||||
result = _(arrayOfKeys).zipObject<number, _.Dictionary<number>>(listOfValues).value();
|
||||
result = _(listOfKeys).zipObject<number, _.Dictionary<number>>(listOfValues).value();
|
||||
result = _(listOfKeys).zipObject<number, _.Dictionary<number>>(arrayOfValues).value();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.Dictionary<any>;
|
||||
|
||||
result = _.zipObject(arrayOfKeys);
|
||||
result = _.zipObject(arrayOfKeys, arrayOfValues);
|
||||
result = _.zipObject(arrayOfKeys, listOfValues);
|
||||
|
||||
result = _.zipObject(listOfKeys);
|
||||
result = _.zipObject(listOfKeys, listOfValues);
|
||||
result = _.zipObject(listOfKeys, arrayOfValues);
|
||||
|
||||
result = _(arrayOfKeys).zipObject().value();
|
||||
result = _(arrayOfKeys).zipObject(arrayOfValues).value();
|
||||
result = _(arrayOfKeys).zipObject(listOfValues).value();
|
||||
|
||||
result = _(listOfKeys).zipObject().value();
|
||||
result = _(listOfKeys).zipObject(listOfValues).value();
|
||||
result = _(listOfKeys).zipObject(arrayOfValues).value();
|
||||
}
|
||||
}
|
||||
|
||||
// _.zipWith
|
||||
interface TestZipWithFn {
|
||||
(a1: number, a2: number): number;
|
||||
|
||||
Vendored
+140
-30
@@ -995,6 +995,79 @@ declare module _ {
|
||||
): number;
|
||||
}
|
||||
|
||||
//_.object
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
object<TValues, TResult extends {}>(
|
||||
props: List<StringRepresentable>,
|
||||
values?: List<TValues>
|
||||
): TResult;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
object<TResult extends {}>(
|
||||
props: List<StringRepresentable>,
|
||||
values?: List<any>
|
||||
): TResult;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
object(
|
||||
props: List<StringRepresentable>,
|
||||
values?: List<any>
|
||||
): _.Dictionary<any>;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
object<TValues, TResult extends {}>(
|
||||
values?: List<TValues>
|
||||
): _.LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
object<TResult extends {}>(
|
||||
values?: List<any>
|
||||
): _.LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
object(
|
||||
values?: List<any>
|
||||
): _.LoDashObjectWrapper<_.Dictionary<any>>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
object<TValues, TResult extends {}>(
|
||||
values?: List<TValues>
|
||||
): _.LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
object<TResult extends {}>(
|
||||
values?: List<any>
|
||||
): _.LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
object(
|
||||
values?: List<any>
|
||||
): _.LoDashObjectWrapper<_.Dictionary<any>>;
|
||||
}
|
||||
|
||||
//_.pull
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -2159,45 +2232,82 @@ declare module _ {
|
||||
//_.zipObject
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
* 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.
|
||||
*
|
||||
* @alias _.object
|
||||
*
|
||||
* @param props The property names.
|
||||
* @param values The property values.
|
||||
* @return Returns the new object.
|
||||
*/
|
||||
zipObject<TValues, TResult extends {}>(
|
||||
props: List<StringRepresentable>,
|
||||
values?: List<TValues>
|
||||
): TResult;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
zipObject<TResult extends {}>(
|
||||
props: List<string>,
|
||||
values?: List<any>): TResult;
|
||||
props: List<StringRepresentable>,
|
||||
values?: List<any>
|
||||
): TResult;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
**/
|
||||
zipObject<TResult extends {}>(props: List<List<any>>): Dictionary<any>;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
**/
|
||||
object<TResult extends {}>(
|
||||
props: List<string>,
|
||||
values?: List<any>): TResult;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
**/
|
||||
object<TResult extends {}>(props: List<List<any>>): Dictionary<any>;
|
||||
* @see _.zipObject
|
||||
*/
|
||||
zipObject(
|
||||
props: List<StringRepresentable>,
|
||||
values?: List<any>
|
||||
): _.Dictionary<any>;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.zipObject
|
||||
**/
|
||||
zipObject(values?: List<any>): _.LoDashObjectWrapper<Dictionary<any>>;
|
||||
* @see _.zipObject
|
||||
*/
|
||||
zipObject<TValues, TResult extends {}>(
|
||||
values?: List<TValues>
|
||||
): _.LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
**/
|
||||
object(values?: List<any>): _.LoDashObjectWrapper<Dictionary<any>>;
|
||||
* @see _.zipObject
|
||||
*/
|
||||
zipObject<TResult extends {}>(
|
||||
values?: List<any>
|
||||
): _.LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
zipObject(
|
||||
values?: List<any>
|
||||
): _.LoDashObjectWrapper<_.Dictionary<any>>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
zipObject<TValues, TResult extends {}>(
|
||||
values?: List<TValues>
|
||||
): _.LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
zipObject<TResult extends {}>(
|
||||
values?: List<any>
|
||||
): _.LoDashObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.zipObject
|
||||
*/
|
||||
zipObject(
|
||||
values?: List<any>
|
||||
): _.LoDashObjectWrapper<_.Dictionary<any>>;
|
||||
}
|
||||
|
||||
//_.zipWith
|
||||
|
||||
Reference in New Issue
Block a user