Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / createBaseFor.js
1 var toObject = require('./toObject');
2
3 /**
4  * Creates a base function for `_.forIn` or `_.forInRight`.
5  *
6  * @private
7  * @param {boolean} [fromRight] Specify iterating from right to left.
8  * @returns {Function} Returns the new base function.
9  */
10 function createBaseFor(fromRight) {
11   return function(object, iteratee, keysFunc) {
12     var iterable = toObject(object),
13         props = keysFunc(object),
14         length = props.length,
15         index = fromRight ? length : -1;
16
17     while ((fromRight ? index-- : ++index < length)) {
18       var key = props[index];
19       if (iteratee(iterable[key], key, iterable) === false) {
20         break;
21       }
22     }
23     return object;
24   };
25 }
26
27 module.exports = createBaseFor;