Version 1
[yaffs-website] / node_modules / grunt-legacy-log / node_modules / lodash / internal / createBaseFor.js
diff --git a/node_modules/grunt-legacy-log/node_modules/lodash/internal/createBaseFor.js b/node_modules/grunt-legacy-log/node_modules/lodash/internal/createBaseFor.js
new file mode 100644 (file)
index 0000000..3c2cac5
--- /dev/null
@@ -0,0 +1,27 @@
+var toObject = require('./toObject');
+
+/**
+ * Creates a base function for `_.forIn` or `_.forInRight`.
+ *
+ * @private
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new base function.
+ */
+function createBaseFor(fromRight) {
+  return function(object, iteratee, keysFunc) {
+    var iterable = toObject(object),
+        props = keysFunc(object),
+        length = props.length,
+        index = fromRight ? length : -1;
+
+    while ((fromRight ? index-- : ++index < length)) {
+      var key = props[index];
+      if (iteratee(iterable[key], key, iterable) === false) {
+        break;
+      }
+    }
+    return object;
+  };
+}
+
+module.exports = createBaseFor;