Version 1
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / once.js
diff --git a/node_modules/grunt-legacy-util/node_modules/lodash/once.js b/node_modules/grunt-legacy-util/node_modules/lodash/once.js
new file mode 100644 (file)
index 0000000..75f7d99
--- /dev/null
@@ -0,0 +1,24 @@
+var before = require('./before');
+
+/**
+ * Creates a function that is restricted to invoking `func` once. Repeat calls
+ * to the function return the value of the first invocation. The `func` is
+ * invoked with the `this` binding and arguments of the created function.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new restricted function.
+ * @example
+ *
+ * var initialize = _.once(createApplication);
+ * initialize();
+ * initialize();
+ * // `initialize` invokes `createApplication` once
+ */
+function once(func) {
+  return before(2, func);
+}
+
+module.exports = once;