Version 1
[yaffs-website] / node_modules / uncss / node_modules / lodash / cloneWith.js
diff --git a/node_modules/uncss/node_modules/lodash/cloneWith.js b/node_modules/uncss/node_modules/lodash/cloneWith.js
new file mode 100644 (file)
index 0000000..e436b1e
--- /dev/null
@@ -0,0 +1,36 @@
+var baseClone = require('./internal/baseClone');
+
+/**
+ * This method is like `_.clone` except that it accepts `customizer` which
+ * is invoked to produce the cloned value. If `customizer` returns `undefined`
+ * cloning is handled by the method instead. The `customizer` is invoked with
+ * up to four arguments; (value [, index|key, object, stack]).
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to clone.
+ * @param {Function} [customizer] The function to customize cloning.
+ * @returns {*} Returns the cloned value.
+ * @example
+ *
+ * function customizer(value) {
+ *   if (_.isElement(value)) {
+ *     return value.cloneNode(false);
+ *   }
+ * }
+ *
+ * var el = _.cloneWith(document.body, customizer);
+ *
+ * console.log(el === document.body);
+ * // => false
+ * console.log(el.nodeName);
+ * // => 'BODY'
+ * console.log(el.childNodes.length);
+ * // => 0
+ */
+function cloneWith(value, customizer) {
+  return baseClone(value, false, customizer);
+}
+
+module.exports = cloneWith;