Version 1
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / ary.js
diff --git a/node_modules/grunt-legacy-util/node_modules/lodash/ary.js b/node_modules/grunt-legacy-util/node_modules/lodash/ary.js
new file mode 100644 (file)
index 0000000..b3906ac
--- /dev/null
@@ -0,0 +1,28 @@
+var createWrapper = require('./_createWrapper');
+
+/** Used to compose bitmasks for wrapper metadata. */
+var ARY_FLAG = 128;
+
+/**
+ * Creates a function that accepts up to `n` arguments, ignoring any
+ * additional arguments.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to cap arguments for.
+ * @param {number} [n=func.length] The arity cap.
+ * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * _.map(['6', '8', '10'], _.ary(parseInt, 1));
+ * // => [6, 8, 10]
+ */
+function ary(func, n, guard) {
+  n = guard ? undefined : n;
+  n = (func && n == null) ? func.length : n;
+  return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
+}
+
+module.exports = ary;