mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-30 11:14:27 +08:00
Merge pull request #6728 from chrootsu/lodash-unzip
lodash: signatures of the method _.unzip have been changed
This commit is contained in:
+33
-2
@@ -1408,6 +1408,39 @@ result = <string[]>_(['A', 'b', 'C', 'a', 'B', 'c']).unique(function (letter) {
|
||||
result = <number[]>_([1, 2.5, 3, 1.5, 2, 3.5]).unique(function (num) { return this.floor(num); }, Math).value();
|
||||
result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').value();
|
||||
|
||||
// _.upzip
|
||||
module TestUnzip {
|
||||
let array = [['a', 'b'], [1, 2], [true, false]];
|
||||
|
||||
let list: _.List<_.List<string|number|boolean>> = {
|
||||
0: {0: 'a', 1: 'b', length: 2},
|
||||
1: {0: 1, 1: 2, length: 2},
|
||||
2: {0: true, 1: false, length: 2},
|
||||
length: 3
|
||||
};
|
||||
|
||||
{
|
||||
let result: (string|number|boolean)[][];
|
||||
|
||||
result = _.unzip<string|number|boolean>(array);
|
||||
result = _.unzip<string|number|boolean>(list);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitArrayWrapper<(string|number|boolean)[]>;
|
||||
|
||||
result = _(array).unzip<string|number|boolean>();
|
||||
result = _(list).unzip<string|number|boolean>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitArrayWrapper<(string|number|boolean)[]>;
|
||||
|
||||
result = _(array).chain().unzip<string|number|boolean>();
|
||||
result = _(list).chain().unzip<string|number|boolean>();
|
||||
}
|
||||
}
|
||||
|
||||
// _.unzipWith
|
||||
{
|
||||
let testUnzipWithArray: (number[]|_.List<number>)[];
|
||||
@@ -1475,9 +1508,7 @@ module TestXor {
|
||||
}
|
||||
|
||||
result = <any[][]>_.zip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
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 {
|
||||
|
||||
Vendored
+40
-15
@@ -2721,6 +2721,46 @@ declare module _ {
|
||||
whereValue: W): LoDashImplicitArrayWrapper<T>;
|
||||
}
|
||||
|
||||
//_.unzip
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* This method is like _.zip except that it accepts an array of grouped elements and creates an array
|
||||
* regrouping the elements to their pre-zip configuration.
|
||||
*
|
||||
* @param array The array of grouped elements to process.
|
||||
* @return Returns the new array of regrouped elements.
|
||||
*/
|
||||
unzip<T>(array: List<List<T>>): T[][];
|
||||
}
|
||||
|
||||
interface LoDashImplicitArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.unzip
|
||||
*/
|
||||
unzip<T>(): LoDashImplicitArrayWrapper<T[]>;
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.unzip
|
||||
*/
|
||||
unzip<T>(): LoDashImplicitArrayWrapper<T[]>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.unzip
|
||||
*/
|
||||
unzip<T>(): LoDashExplicitArrayWrapper<T[]>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.unzip
|
||||
*/
|
||||
unzip<T>(): LoDashExplicitArrayWrapper<T[]>;
|
||||
}
|
||||
|
||||
//_.unzipWith
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -2829,16 +2869,6 @@ declare module _ {
|
||||
* @see _.zip
|
||||
**/
|
||||
zip(...arrays: any[]): any[];
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
**/
|
||||
unzip(...arrays: any[][]): any[][];
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
**/
|
||||
unzip(...arrays: any[]): any[];
|
||||
}
|
||||
|
||||
interface LoDashImplicitArrayWrapper<T> {
|
||||
@@ -2846,11 +2876,6 @@ declare module _ {
|
||||
* @see _.zip
|
||||
**/
|
||||
zip(...arrays: any[][]): _.LoDashImplicitArrayWrapper<any[][]>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
**/
|
||||
unzip(...arrays: any[]): _.LoDashImplicitArrayWrapper<any[][]>;
|
||||
}
|
||||
|
||||
//_.zipObject
|
||||
|
||||
Reference in New Issue
Block a user