diff options
author | 2020-11-16 00:10:28 +0100 | |
---|---|---|
committer | 2020-11-16 00:10:28 +0100 | |
commit | e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d (patch) | |
tree | 55713f725f77b44ebfec86e4eec3ce33e71458ca /node_modules/async-foreach/dist | |
download | website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.gz website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.bz2 website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.zip |
api, login, auth
Diffstat (limited to 'node_modules/async-foreach/dist')
-rw-r--r-- | node_modules/async-foreach/dist/ba-foreach.js | 58 | ||||
-rw-r--r-- | node_modules/async-foreach/dist/ba-foreach.min.js | 4 |
2 files changed, 62 insertions, 0 deletions
diff --git a/node_modules/async-foreach/dist/ba-foreach.js b/node_modules/async-foreach/dist/ba-foreach.js new file mode 100644 index 0000000..64c6eb8 --- /dev/null +++ b/node_modules/async-foreach/dist/ba-foreach.js @@ -0,0 +1,58 @@ +/* JavaScript Sync/Async forEach - v0.1.2 - 1/10/2012 + * http://github.com/cowboy/javascript-sync-async-foreach + * Copyright (c) 2012 "Cowboy" Ben Alman; Licensed MIT */ + +(function(exports) { + + // Iterate synchronously or asynchronously. + exports.forEach = function(arr, eachFn, doneFn) { + var i = -1; + // Resolve array length to a valid (ToUint32) number. + var len = arr.length >>> 0; + + // This IIFE is called once now, and then again, by name, for each loop + // iteration. + (function next(result) { + // This flag will be set to true if `this.async` is called inside the + // eachFn` callback. + var async; + // Was false returned from the `eachFn` callback or passed to the + // `this.async` done function? + var abort = result === false; + + // Increment counter variable and skip any indices that don't exist. This + // allows sparse arrays to be iterated. + do { ++i; } while (!(i in arr) && i !== len); + + // Exit if result passed to `this.async` done function or returned from + // the `eachFn` callback was false, or when done iterating. + if (abort || i === len) { + // If a `doneFn` callback was specified, invoke that now. Pass in a + // boolean value representing "not aborted" state along with the array. + if (doneFn) { + doneFn(!abort, arr); + } + return; + } + + // Invoke the `eachFn` callback, setting `this` inside the callback to a + // custom object that contains one method, and passing in the array item, + // index, and the array. + result = eachFn.call({ + // If `this.async` is called inside the `eachFn` callback, set the async + // flag and return a function that can be used to continue iterating. + async: function() { + async = true; + return next; + } + }, arr[i], i, arr); + + // If the async flag wasn't set, continue by calling `next` synchronously, + // passing in the result of the `eachFn` callback. + if (!async) { + next(result); + } + }()); + }; + +}(typeof exports === "object" && exports || this));
\ No newline at end of file diff --git a/node_modules/async-foreach/dist/ba-foreach.min.js b/node_modules/async-foreach/dist/ba-foreach.min.js new file mode 100644 index 0000000..c218a91 --- /dev/null +++ b/node_modules/async-foreach/dist/ba-foreach.min.js @@ -0,0 +1,4 @@ +/* JavaScript Sync/Async forEach - v0.1.2 - 1/10/2012 + * http://github.com/cowboy/javascript-sync-async-foreach + * Copyright (c) 2012 "Cowboy" Ben Alman; Licensed MIT */ +(function(a){a.forEach=function(a,b,c){var d=-1,e=a.length>>>0;(function f(g){var h,j=g===!1;do++d;while(!(d in a)&&d!==e);if(j||d===e){c&&c(!j,a);return}g=b.call({async:function(){return h=!0,f}},a[d],d,a),h||f(g)})()}})(typeof exports=="object"&&exports||this)
\ No newline at end of file |