lodash: sugnatures of _.zip have been changed

This commit is contained in:
Ilya Mochalov
2015-11-20 04:00:43 +05:00
parent 16134c168d
commit 6825bb501f
2 changed files with 68 additions and 17 deletions
+37 -2
View File
@@ -1615,8 +1615,43 @@ module TestXor {
}
}
result = <any[][]>_.zip(['moe', 'larry'], [30, 40], [true, false]);
result = <any[][]>_(['moe', 'larry']).zip([30, 40], [true, false]).value();
// _.zip
module TestZip {
let array: TResult[];
let list: _.List<TResult>;
{
let result: TResult[][];
result = _.zip<TResult>(array);
result = _.zip<TResult>(array, list);
result = _.zip<TResult>(array, list, array);
result = _.zip<TResult>(list);
result = _.zip<TResult>(list, array);
result = _.zip<TResult>(list, array, list);
}
{
let result: _.LoDashImplicitArrayWrapper<TResult[]>;
result = _(array).zip<TResult>(list);
result = _(array).zip<TResult>(list, array);
result = _(list).zip<TResult>(array);
result = _(list).zip<TResult>(array, list);
}
{
let result: _.LoDashExplicitArrayWrapper<TResult[]>;
result = _(array).chain().zip<TResult>(list);
result = _(array).chain().zip<TResult>(list, array);
result = _(list).chain().zip<TResult>(array);
result = _(list).chain().zip<TResult>(array, list);
}
}
// _.zipObject
module TestZipObject {
+31 -15
View File
@@ -2931,25 +2931,41 @@ declare module _ {
//_.zip
interface LoDashStatic {
/**
* Creates an array of grouped elements, the first of which contains the first
* elements of the given arrays, the second of which contains the second elements
* of the given arrays, and so on.
* @param arrays Arrays to process.
* @return A new array of grouped elements.
**/
zip(...arrays: any[][]): any[][];
/**
* @see _.zip
**/
zip(...arrays: any[]): any[];
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
* the second of which contains the second elements of the given arrays, and so on.
*
* @param arrays The arrays to process.
* @return Returns the new array of grouped elements.
*/
zip<T>(...arrays: List<T>[]): T[][];
}
interface LoDashImplicitArrayWrapper<T> {
/**
* @see _.zip
**/
zip(...arrays: any[][]): _.LoDashImplicitArrayWrapper<any[][]>;
* @see _.zip
*/
zip<T>(...arrays: List<T>[]): _.LoDashImplicitArrayWrapper<T[]>;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.zip
*/
zip<T>(...arrays: List<T>[]): _.LoDashImplicitArrayWrapper<T[]>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.zip
*/
zip<T>(...arrays: List<T>[]): _.LoDashExplicitArrayWrapper<T[]>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.zip
*/
zip<T>(...arrays: List<T>[]): _.LoDashExplicitArrayWrapper<T[]>;
}
//_.zipObject