Version 1
[yaffs-website] / node_modules / uncss / node_modules / lodash / zipObject.js
diff --git a/node_modules/uncss/node_modules/lodash/zipObject.js b/node_modules/uncss/node_modules/lodash/zipObject.js
new file mode 100644 (file)
index 0000000..fd5c103
--- /dev/null
@@ -0,0 +1,30 @@
+var baseSet = require('./internal/baseSet');
+
+/**
+ * This method is like `_.fromPairs` except that it accepts two arrays,
+ * one of property names and one of corresponding values.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} [props=[]] The property names.
+ * @param {Array} [values=[]] The property values.
+ * @returns {Object} Returns the new object.
+ * @example
+ *
+ * _.zipObject(['fred', 'barney'], [30, 40]);
+ * // => { 'fred': 30, 'barney': 40 }
+ */
+function zipObject(props, values) {
+  var index = -1,
+      length = props ? props.length : 0,
+      valsLength = values ? values.length : 0,
+      result = {};
+
+  while (++index < length) {
+    baseSet(result, props[index], index < valsLength ? values[index] : undefined);
+  }
+  return result;
+}
+
+module.exports = zipObject;