Skip to content
Open
Changes from all commits
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
37 changes: 15 additions & 22 deletions lib/node_modules/@stdlib/utils/async/inmap/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,28 @@ var factory = require( './factory.js' );
* @returns {void}
*
* @example
* var readFile = require( '@stdlib/fs/read-file' );
* var nextTick = require( '@stdlib/utils/next-tick' );
* var inmapAsync = require( '@stdlib/utils/async/inmap' );
*
* function done( error, results ) {
* if ( error ) {
* throw error;
* }
* console.log( results );
* }
* var arr = [ 1, 2, 3, 4 ];
*
* function read( file, next ) {
* var opts = {
* 'encoding': 'utf8'
* };
* readFile( file, opts, onFile );
* function iterator( val, next ) {
* nextTick( cb );
* function cb() {
* // Return the value multiplied by 2...
* next( null, val*2 );
* }
* }
*
* function onFile( error, data ) {
* function done( error, result ) {
* if ( error ) {
* return next( error );
* throw error;
* }
* next( null, data );
* }
* console.log( result );
* // => [ 2, 4, 6, 8 ]
* }
*
* var files = [
* './beep.js',
* './boop.js'
* ];
*
* inmapAsync( files, read, done );
* inmapAsync( arr, iterator, done );
*/
function inmapAsync( collection, options, fcn, done ) {
if ( arguments.length < 4 ) {
Expand Down