Merge pull request #6788 from chrootsu/lodash-forInRight

lodash: signatures of the method _.forInRight have been changed
This commit is contained in:
Masahiro Wakame
2015-11-19 23:22:50 +09:00
2 changed files with 73 additions and 25 deletions
+41 -6
View File
@@ -5972,13 +5972,48 @@ module TestForIn {
}
}
result = <Dog>_.forInRight(new Dog('Dagny'), function (value, key) {
console.log(key);
});
// _.forInRight
module TestForInRight {
type SampleObject = {a: number; b: string; c: boolean;};
result = <_.LoDashImplicitObjectWrapper<Dog>>_(new Dog('Dagny')).forInRight(function (value, key) {
console.log(key);
});
let dictionary: _.Dictionary<number>;
let dictionaryIterator: (value: number, key: string, collection: _.Dictionary<number>) => any;
let object: SampleObject;
let objectIterator: (element: any, key?: string, collection?: any) => any;
{
let result: _.Dictionary<number>;
result = _.forInRight<number>(dictionary);
result = _.forInRight<number>(dictionary, dictionaryIterator);
result = _.forInRight<number>(dictionary, dictionaryIterator, any);
}
{
let result: SampleObject;
result = _.forInRight<SampleObject>(object);
result = _.forInRight<SampleObject>(object, objectIterator);
result = _.forInRight<SampleObject>(object, objectIterator, any);
}
{
let result: _.LoDashImplicitObjectWrapper<_.Dictionary<number>>;
result = _(dictionary).forInRight<number>();
result = _(dictionary).forInRight<number>(dictionaryIterator);
result = _(dictionary).forInRight<number>(dictionaryIterator, any);
}
{
let result: _.LoDashExplicitObjectWrapper<_.Dictionary<number>>;
result = _(dictionary).chain().forInRight<number>();
result = _(dictionary).chain().forInRight<number>(dictionaryIterator);
result = _(dictionary).chain().forInRight<number>(dictionaryIterator, any);
}
}
// _.forOwn
module TestForOwn {
+32 -19
View File
@@ -10439,34 +10439,47 @@ declare module _ {
//_.forInRight
interface LoDashStatic {
/**
* This method is like _.forIn except that it iterates over elements of a collection in the
* opposite order.
* @param object The object to iterate over.
* @param callback The function called per iteration.
* @param thisArg The this binding of callback.
* @return object
**/
forInRight<T extends {}>(
* This method is like _.forIn except that it iterates over properties of object in the opposite order.
*
* @param object The object to iterate over.
* @param iteratee The function invoked per iteration.
* @param thisArg The this binding of iteratee.
* @return Returns object.
*/
forInRight<T>(
object: Dictionary<T>,
callback?: DictionaryIterator<T, void>,
thisArg?: any): Dictionary<T>;
iteratee?: DictionaryIterator<T, any>,
thisArg?: any
): Dictionary<T>;
/**
* @see _.forInRight
**/
* @see _.forInRight
*/
forInRight<T extends {}>(
object: T,
callback?: ObjectIterator<T, void>,
thisArg?: any): T;
iteratee?: ObjectIterator<any, any>,
thisArg?: any
): T;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.forInRight
**/
forInRight<T extends {}>(
callback: ObjectIterator<T, void>,
thisArg?: any): _.LoDashImplicitObjectWrapper<T>;
* @see _.forInRight
*/
forInRight<TValue>(
iteratee?: DictionaryIterator<TValue, any>,
thisArg?: any
): _.LoDashImplicitObjectWrapper<T>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.forInRight
*/
forInRight<TValue>(
iteratee?: DictionaryIterator<TValue, any>,
thisArg?: any
): _.LoDashExplicitObjectWrapper<T>;
}
//_.forOwn