Version 1
[yaffs-website] / node_modules / grunt-legacy-log / node_modules / lodash / internal / createObjectMapper.js
diff --git a/node_modules/grunt-legacy-log/node_modules/lodash/internal/createObjectMapper.js b/node_modules/grunt-legacy-log/node_modules/lodash/internal/createObjectMapper.js
new file mode 100644 (file)
index 0000000..06d6a87
--- /dev/null
@@ -0,0 +1,26 @@
+var baseCallback = require('./baseCallback'),
+    baseForOwn = require('./baseForOwn');
+
+/**
+ * Creates a function for `_.mapKeys` or `_.mapValues`.
+ *
+ * @private
+ * @param {boolean} [isMapKeys] Specify mapping keys instead of values.
+ * @returns {Function} Returns the new map function.
+ */
+function createObjectMapper(isMapKeys) {
+  return function(object, iteratee, thisArg) {
+    var result = {};
+    iteratee = baseCallback(iteratee, thisArg, 3);
+
+    baseForOwn(object, function(value, key, object) {
+      var mapped = iteratee(value, key, object);
+      key = isMapKeys ? mapped : key;
+      value = isMapKeys ? value : mapped;
+      result[key] = value;
+    });
+    return result;
+  };
+}
+
+module.exports = createObjectMapper;