lodash: signatures of the method _.pairs have been changed

This commit is contained in:
Ilya Mochalov
2015-11-15 09:57:45 +05:00
parent aed176536a
commit 216ef06c33
2 changed files with 58 additions and 11 deletions
+40 -2
View File
@@ -5458,8 +5458,46 @@ result = <HasName>_({ 'name': 'moe', 'age': 40 }).omit(function (value) {
return typeof value == 'number';
}).value();
result = <any[][]>_.pairs({ 'moe': 30, 'larry': 40 });
result = <any[][]>_({ 'moe': 30, 'larry': 40 }).pairs().value();
// _.pairs
module TestPairs {
let object: _.Dictionary<string>;
{
let result: any[][];
result = _.pairs<_.Dictionary<string>>(object);
}
{
let result: string[][];
result = _.pairs<_.Dictionary<string>, string>(object);
}
{
let result: _.LoDashImplicitArrayWrapper<string[]>;
result = _(object).pairs<string>();
}
{
let result: _.LoDashImplicitArrayWrapper<any[]>;
result = _(object).pairs();
}
{
let result: _.LoDashExplicitArrayWrapper<string[]>;
result = _(object).chain().pairs<string>();
}
{
let result: _.LoDashExplicitArrayWrapper<any[]>;
result = _(object).chain().pairs();
}
}
// _.pick
interface TestPickFn {
+18 -9
View File
@@ -10518,19 +10518,28 @@ declare module _ {
//_.pairs
interface LoDashStatic {
/**
* Creates a two dimensional array of an object's key-value pairs,
* i.e. [[key1, value1], [key2, value2]].
* @param object The object to inspect.
* @return Aew array of key-value pairs.
**/
pairs(object?: any): any[][];
* Creates a two dimensional array of the key-value pairs for object, e.g. [[key1, value1], [key2, value2]].
*
* @param object The object to query.
* @return Returns the new array of key-value pairs.
*/
pairs<T extends {}>(object?: T): any[][];
pairs<T extends {}, TResult>(object?: T): TResult[][];
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.pairs
**/
pairs(): LoDashImplicitArrayWrapper<any[]>;
* @see _.pairs
*/
pairs<TResult>(): LoDashImplicitArrayWrapper<TResult[]>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.pairs
*/
pairs<TResult>(): LoDashExplicitArrayWrapper<TResult[]>;
}
//_.pick