mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Remove semicolons.
This commit is contained in:
20
after.js
20
after.js
@@ -1,7 +1,7 @@
|
||||
import toInteger from './toInteger.js';
|
||||
import toInteger from './toInteger.js'
|
||||
|
||||
/**
|
||||
* The opposite of `before`; this method creates a function that invokes
|
||||
* The opposite of `before`his method creates a function that invokes
|
||||
* `func` once it's called `n` or more times.
|
||||
*
|
||||
* @since 0.1.0
|
||||
@@ -11,22 +11,22 @@ import toInteger from './toInteger.js';
|
||||
* @returns {Function} Returns the new restricted function.
|
||||
* @example
|
||||
*
|
||||
* const saves = ['profile', 'settings'];
|
||||
* const done = after(saves.length, () => console.log('done saving!'));
|
||||
* const saves = ['profile', 'settings']
|
||||
* const done = after(saves.length, () => console.log('done saving!'))
|
||||
*
|
||||
* forEach(saves, type => asyncSave({ 'type': type, 'complete': done }));
|
||||
* forEach(saves, type => asyncSave({ 'type': type, 'complete': done }))
|
||||
* // => Logs 'done saving!' after the two async saves have completed.
|
||||
*/
|
||||
function after(n, func) {
|
||||
if (typeof func != 'function') {
|
||||
throw new TypeError('Expected a function');
|
||||
throw new TypeError('Expected a function')
|
||||
}
|
||||
n = toInteger(n);
|
||||
n = toInteger(n)
|
||||
return function(...args) {
|
||||
if (--n < 1) {
|
||||
return func.apply(this, args);
|
||||
return func.apply(this, args)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default after;
|
||||
export default after
|
||||
|
||||
Reference in New Issue
Block a user