Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
var baseFor = require('../internal/baseFor'),
2
createForIn = require('../internal/createForIn');
3
4
/**
5
* Iterates over own and inherited enumerable properties of an object invoking
6
* `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked
7
* with three arguments: (value, key, object). Iteratee functions may exit
8
* iteration early by explicitly returning `false`.
9
*
10
* @static
11
* @memberOf _
12
* @category Object
13
* @param {Object} object The object to iterate over.
14
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
15
* @param {*} [thisArg] The `this` binding of `iteratee`.
16
* @returns {Object} Returns `object`.
17
* @example
18
*
19
* function Foo() {
20
* this.a = 1;
21
* this.b = 2;
22
* }
23
*
24
* Foo.prototype.c = 3;
25
*
26
* _.forIn(new Foo, function(value, key) {
27
* console.log(key);
28
* });
29
* // => logs 'a', 'b', and 'c' (iteration order is not guaranteed)
30
*/
31
var forIn = createForIn(baseFor);
32
33
module.exports = forIn;
34
35