foreachthen
v1.3.1
Published
new array prototype that uses async to wait for a for loop to finish
Downloads
2
Readme
#For Each Then
License
The License information is avaliable in license.txt
##Summary This module provide a function on arrays called forEachThen. it allows you to specify a method that must be run after the for loop has completed/
var array = [ "list","of","stuff" ];
array.forEachThen(function(callback, item, idx) {
console.log("This method is run for each item in the array. Callback must be called in this function");
callback();
},
function () {
console.log("This method runs after all items have been processed");
} );
var array = [ "list","of","stuff" ];
array.forEachThenSeries(function(callback, item, idx) {
console.log("This method is run for each item in the array in a sequential order. Callback must be called in this function");
callback();
},
function () {
console.log("This method runs after all items have been processed");
} );
var fet = require('foreachthen');
var object = { "key" : "value" }
fet.ObjectforEach(object,function(key, value, idx) {
console.log("This will return keys and values as it goes over the object");
console.log(key);
console.log(value);
console.log(idx);
callback();
});
var fet = require('foreachthen');
var object = { "key" : "value" }
fet.ObjectforEachThen(object,function(callback, item, idx) {
console.log("This method is run for each item in the array. Callback must be called in this function");
callback();
},
function () {
console.log("This method runs after all items have been processed");
} );
var fet = require('foreachthen');
var object = { "key" : "value" }
fet.ObjectforEachThenSeries(object,function(callback, item, idx) {
console.log("This method is run for each item in the array in a sequential order. Callback must be called in this function");
callback();
},
function () {
console.log("This method runs after all items have been processed");
} );