Sha256: 116606b51328f022d6dc2cf5f982331dd85b603a7e81ff950cff7438b7972c75
Contents?: true
Size: 636 Bytes
Versions: 14
Compression:
Stored size: 636 Bytes
Contents
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 call. The `func` is invoked * with the `this` binding 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(func, 2); } module.exports = once;
Version data entries
14 entries across 7 versions & 1 rubygems