source: trip-planner-front/node_modules/lodash/once.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 665 bytes
RevLine 
[6a3a178]1var before = require('./before');
2
3/**
4 * Creates a function that is restricted to invoking `func` once. Repeat calls
5 * to the function return the value of the first invocation. The `func` is
6 * invoked with the `this` binding and arguments of the created function.
7 *
8 * @static
9 * @memberOf _
10 * @since 0.1.0
11 * @category Function
12 * @param {Function} func The function to restrict.
13 * @returns {Function} Returns the new restricted function.
14 * @example
15 *
16 * var initialize = _.once(createApplication);
17 * initialize();
18 * initialize();
19 * // => `createApplication` is invoked once
20 */
21function once(func) {
22 return before(2, func);
23}
24
25module.exports = once;
Note: See TracBrowser for help on using the repository browser.