Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
var baseForOwn = require('../internal/baseForOwn'),
2
createForOwn = require('../internal/createForOwn');
3
4
/**
5
* Iterates over own enumerable properties of an object invoking `iteratee`
6
* for each property. The `iteratee` is bound to `thisArg` and invoked with
7
* three arguments: (value, key, object). Iteratee functions may exit iteration
8
* 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
* _.forOwn(new Foo, function(value, key) {
27
* console.log(key);
28
* });
29
* // => logs 'a' and 'b' (iteration order is not guaranteed)
30
*/
31
var forOwn = createForOwn(baseForOwn);
32
33
module.exports = forOwn;
34
35