Security update for Core, with self-updated composer
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / forOwn.js
1 var baseForOwn = require('./_baseForOwn'),
2     toFunction = require('./_toFunction');
3
4 /**
5  * Iterates over own enumerable properties of an object invoking `iteratee`
6  * for each property. The iteratee is invoked with three arguments:
7  * (value, key, object). Iteratee functions may exit iteration early by
8  * 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  * @returns {Object} Returns `object`.
16  * @example
17  *
18  * function Foo() {
19  *   this.a = 1;
20  *   this.b = 2;
21  * }
22  *
23  * Foo.prototype.c = 3;
24  *
25  * _.forOwn(new Foo, function(value, key) {
26  *   console.log(key);
27  * });
28  * // => logs 'a' then 'b' (iteration order is not guaranteed)
29  */
30 function forOwn(object, iteratee) {
31   return object && baseForOwn(object, toFunction(iteratee));
32 }
33
34 module.exports = forOwn;