New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

echasync

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

echasync

asyncronous foreach method

latest
Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
12
9.09%
Maintainers
1
Weekly downloads
 
Created
Source

Prefer Videos ?

Watch this video to see an example

Installation

npm install echasync

Usage

This is wrote following the OADS Standards.

echasync.do([loopedArray],operation(next(),element,#index,[loopedArray]),callback())

Loops through an array asynchronously.

  • [loopedArray]: The array you want loop through.
  • operation(): The function you want to run for each element in the array.
    • next(): When you call to this function, you move to the next element.
    • element: The value of the element being handled.
    • #index: The index of the element being handled.
    • [loopedArray]: The array you are looping through.
  • callback(): The function to run when all the elements are been handled.

Eg:

var echasync = require('echasync');
var files = ['1.txt','2.txt','3.txt','4.txt','5.txt'];
var contents = [];
echasync.do(files,function (next,filename,index,files) {
    fs.readFile(filename,function(err,data){
        if(!err) {
            contents.push(data);
            next();
        }
    });
},function () {
    console.log(contents);
});

Keywords

foreach

FAQs

Package last updated on 21 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts