importtoIntegerfrom'./toInteger.js'; /** Error message constants. */varFUNC_ERROR_TEXT='Expected a function'; /** * The opposite of `_.before`; this method creates a function that invokes * `func` once it's called `n` or more times. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {number} n The number of calls before `func` is invoked. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var saves = ['profile', 'settings']; * * var done = _.after(saves.length, function() { * console.log('done saving!'); * }); * * _.forEach(saves, function(type) { * asyncSave({ 'type': type, 'complete': done }); * }); * // => Logs 'done saving!' after the two async saves have completed. */functionafter(n, func){if(typeof func !='function'){thrownewTypeError(FUNC_ERROR_TEXT);} n =toInteger(n);returnfunction(){if(--n <1){return func.apply(this, arguments);}};} exportdefault after;