mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 05:20:25 +00:00
added _.forIn definition
This commit is contained in:
@@ -554,6 +554,18 @@ result = <string>_.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num)
|
||||
return num % 2 == 1;
|
||||
});
|
||||
|
||||
function Dog(name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
Dog.prototype.bark = function() {
|
||||
console.log('Woof, woof!');
|
||||
};
|
||||
|
||||
_.forIn(new Dog('Dagny'), function(value, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
var mergeNames = {
|
||||
'stooges': [
|
||||
{ 'name': 'moe' },
|
||||
|
||||
Vendored
+15
@@ -2263,6 +2263,21 @@ declare module _ {
|
||||
object: any,
|
||||
whereValue: Dictionary<any>): string;
|
||||
|
||||
/**
|
||||
* Iterates over own and inherited enumerable properties of an object, executing the callback for
|
||||
* each property. The callback is bound to thisArg and invoked with three arguments; (value, key,
|
||||
* object). Callbacks may exit iteration early by explicitly returning false.
|
||||
* @param object The object to iterate over.
|
||||
* @param callback The function called per iteration.
|
||||
* @param thisArg The this binding of callback.
|
||||
* @return object
|
||||
**/
|
||||
export function forIn<T extends {}>(
|
||||
object: Dictionary<T>,
|
||||
callback?: ObjectIterator<T, void>,
|
||||
thisArg?: any): Dictionary<T>;
|
||||
|
||||
|
||||
/**
|
||||
* Recursively merges own enumerable properties of the source object(s), that don't resolve
|
||||
* to undefined into the destination object. Subsequent sources will overwrite property
|
||||
|
||||
Reference in New Issue
Block a user