Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

/* eslint-disable no-new-wrappers, no-undefined, no-empty-function */
/* eslint-disable no-undefined, no-empty-function */

'use strict';

Expand Down
42 changes: 21 additions & 21 deletions lib/node_modules/@stdlib/utils/async/reduce-right/lib/limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,27 @@ function limit( collection, acc, opts, fcn, done ) {
}
}
/**
* Callback invoked once a provided function finishes processing a collection element.
*
* @private
* @param {*} [error] - error
* @param {*} [result] - accumulation result
* @returns {void}
*/
function cb( error, result ) {
if ( flg ) {
// Prevent further processing of collection elements:
return;
}
if ( error ) {
flg = true;
return clbk( error );
}
debug( 'Accumulator: %s', JSON.stringify( result ) );
acc = result;
clbk();
}
/**
* Callback to invoke a provided function for the next element in a collection.
*
* @private
Expand All @@ -89,27 +110,6 @@ function limit( collection, acc, opts, fcn, done ) {
} else {
fcn.call( opts.thisArg, acc, collection[ idx ], idx, collection, cb ); // eslint-disable-line max-len
}
/**
* Callback invoked once a provided function finishes processing a collection element.
*
* @private
* @param {*} [error] - error
* @param {*} [result] - accumulation result
* @returns {void}
*/
function cb( error, result ) {
if ( flg ) {
// Prevent further processing of collection elements:
return;
}
if ( error ) {
flg = true;
return clbk( error );
}
debug( 'Accumulator: %s', JSON.stringify( result ) );
acc = result;
clbk();
}
}

/**
Expand Down