Sha256: c66a624e6d82cee0825a204ef5a727051574263b6b643f0ee62bf1333e058825

Contents?: true

Size: 650 Bytes

Versions: 153

Compression:

Stored size: 650 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 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;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
ilog-0.4.1 node_modules/contents/node_modules/lodash/function/once.js
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/function/once.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/function/once.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/function/once.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/function/once.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/function/once.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/function/once.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/function/once.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/function/once.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/once.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/function/once.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/once.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/function/once.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/once.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/function/once.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/function/once.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/once.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/function/once.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/function/once.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/function/once.js