mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Update _.after to be in sync with Underscore v1.5.0.
Former-commit-id: d50446cb946a453c081cadff0b0a6245bc45eec4
This commit is contained in:
12
lodash.js
12
lodash.js
@@ -4571,17 +4571,14 @@
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If `n` is greater than `0`, a function is created that is restricted to
|
* Creates a function this is restricted to executing `func`, with the `this`
|
||||||
* executing `func`, with the `this` binding and arguments of the created
|
* binding and arguments of the created function, only after it is called `n` times.
|
||||||
* function, only after it is called `n` times. If `n` is less than `1`,
|
|
||||||
* `func` is executed immediately, without a `this` binding or additional
|
|
||||||
* arguments, and its result is returned.
|
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Functions
|
* @category Functions
|
||||||
* @param {Number} n The number of times the function must be called before
|
* @param {Number} n The number of times the function must be called before
|
||||||
* it is executed.
|
* `func` is executed.
|
||||||
* @param {Function} func The function to restrict.
|
* @param {Function} func The function to restrict.
|
||||||
* @returns {Function} Returns the new restricted function.
|
* @returns {Function} Returns the new restricted function.
|
||||||
* @example
|
* @example
|
||||||
@@ -4593,9 +4590,6 @@
|
|||||||
* // `renderNotes` is run once, after all notes have saved
|
* // `renderNotes` is run once, after all notes have saved
|
||||||
*/
|
*/
|
||||||
function after(n, func) {
|
function after(n, func) {
|
||||||
if (n < 1) {
|
|
||||||
return func();
|
|
||||||
}
|
|
||||||
return function() {
|
return function() {
|
||||||
if (--n < 1) {
|
if (--n < 1) {
|
||||||
return func.apply(this, arguments);
|
return func.apply(this, arguments);
|
||||||
|
|||||||
Reference in New Issue
Block a user