Async module practice

Practice using the nodejs async module

by Andrew Faulkner

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/async/1.4.0/async.js"></script>

JavaScript

// setting any of these to false will prevent the associated example from producing alerts 
var alertConfig = {
    eachOn: false,
	eachVerbose: false,
	everyOn: false,
    mapOn_verbose: false,
	parallelOn: false,
    seriesOn: false,
    waterfallOn: false
}

// random example string array for async.map and async.each to operate on.
var watArr = ["A-well-a", "everybody's heard about the bird", 
              "Bird, bird, bird, b-bird's the word", "a-well-a", 
              "Bird, bird, bird, b-bird's the word", 
              "A-well-a, everybody's heard about the bird", 
              "Bird, bird, bird, b-bird's the word", 
              "A-well-a, bird, bird, bird, well, the bird is the word", 
              "Well", "everybody knows", "that the bird is the word", 
              "A-well-a, bird", "Surfin' bird",         
              "Bbbbbbbbbbbbbbbbbb", "aaah", 
              "A-well-a, bird, bird, bird, b-bird's the word"];

// COVERED: each, waterfall, parallel, series, every, map

//*************************************************************************************************//
//
// async.series
//
//Run tasks array of fns in parallel, w/out waiting until prev fn done. If any fn pass err to cb, final cb called w/ the err; once all done, results passed to final cb as an array


//*************************************************************************************************//


//*************************************************************************************************//
//
// async.every
//
//Run tasks array of fns in parallel, w/out waiting until prev fn done. If any fn pass err to cb, final cb called w/ the err; once all done, results passed to final cb as an array

(function tryingEvery(){
	var isItANum = function isItANumber(num, callback){
        logEv(num);
        callback(typeof num === 'number');
    }
    
    async.every([3597345, 1, 3, 5, 183, 2], isItANum, function(result){
        logEv("ASYNC.EVERY RESULT::: " + result);
   ...