@nocobase/plugin-backup-restore 1.6.20 → 1.6.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/d0c15e9119b8e3d3.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +5 -5
- package/dist/node_modules/@hapi/topo/package.json +1 -1
- package/dist/node_modules/archiver/index.js +2 -2
- package/dist/node_modules/archiver/node_modules/async/all.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/allLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/allSeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/any.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/anyLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/anySeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/apply.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/applyEach.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/applyEachSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/asyncify.js +118 -0
- package/dist/node_modules/archiver/node_modules/async/auto.js +333 -0
- package/dist/node_modules/archiver/node_modules/async/autoInject.js +182 -0
- package/dist/node_modules/archiver/node_modules/async/bower.json +17 -0
- package/dist/node_modules/archiver/node_modules/async/cargo.js +63 -0
- package/dist/node_modules/archiver/node_modules/async/cargoQueue.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/compose.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/concat.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/concatLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/concatSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/constant.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/detect.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/detectLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/detectSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/dir.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.js +6062 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.min.js +1 -0
- package/dist/node_modules/archiver/node_modules/async/doDuring.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/doUntil.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/doWhilst.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/during.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/each.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/eachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/eachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/eachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/ensureAsync.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/every.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/everyLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/everySeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filter.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/filterLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filterSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/find.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/findLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/findSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/flatMap.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/foldl.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/foldr.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/forEach.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/forEachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/forEachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/forever.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/groupBy.js +108 -0
- package/dist/node_modules/archiver/node_modules/async/groupByLimit.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/groupBySeries.js +36 -0
- package/dist/node_modules/archiver/node_modules/async/index.js +588 -0
- package/dist/node_modules/archiver/node_modules/async/inject.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/internal/DoublyLinkedList.js +92 -0
- package/dist/node_modules/archiver/node_modules/async/internal/Heap.js +120 -0
- package/dist/node_modules/archiver/node_modules/async/internal/applyEach.js +29 -0
- package/dist/node_modules/archiver/node_modules/async/internal/asyncEachOfLimit.js +75 -0
- package/dist/node_modules/archiver/node_modules/async/internal/awaitify.js +28 -0
- package/dist/node_modules/archiver/node_modules/async/internal/breakLoop.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/consoleFunc.js +31 -0
- package/dist/node_modules/archiver/node_modules/async/internal/createTester.js +40 -0
- package/dist/node_modules/archiver/node_modules/async/internal/eachOfLimit.js +90 -0
- package/dist/node_modules/archiver/node_modules/async/internal/filter.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/internal/getIterator.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/internal/initialParams.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/isArrayLike.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/iterator.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/internal/map.js +30 -0
- package/dist/node_modules/archiver/node_modules/async/internal/once.js +17 -0
- package/dist/node_modules/archiver/node_modules/async/internal/onlyOnce.js +15 -0
- package/dist/node_modules/archiver/node_modules/async/internal/parallel.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/promiseCallback.js +23 -0
- package/dist/node_modules/archiver/node_modules/async/internal/queue.js +294 -0
- package/dist/node_modules/archiver/node_modules/async/internal/range.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/reject.js +26 -0
- package/dist/node_modules/archiver/node_modules/async/internal/setImmediate.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/withoutIndex.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/wrapAsync.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/log.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/map.js +142 -0
- package/dist/node_modules/archiver/node_modules/async/mapLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/mapSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/mapValues.js +152 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesLimit.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/memoize.js +91 -0
- package/dist/node_modules/archiver/node_modules/async/nextTick.js +52 -0
- package/dist/node_modules/archiver/node_modules/async/package.json +75 -0
- package/dist/node_modules/archiver/node_modules/async/parallel.js +180 -0
- package/dist/node_modules/archiver/node_modules/async/parallelLimit.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/priorityQueue.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/queue.js +24 -0
- package/dist/node_modules/archiver/node_modules/async/race.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/reduce.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/reduceRight.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/reflect.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/reflectAll.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/reject.js +87 -0
- package/dist/node_modules/archiver/node_modules/async/rejectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/rejectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/retry.js +159 -0
- package/dist/node_modules/archiver/node_modules/async/retryable.js +77 -0
- package/dist/node_modules/archiver/node_modules/async/select.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/selectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/selectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/seq.js +79 -0
- package/dist/node_modules/archiver/node_modules/async/series.js +186 -0
- package/dist/node_modules/archiver/node_modules/async/setImmediate.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/some.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/someLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/someSeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/sortBy.js +190 -0
- package/dist/node_modules/archiver/node_modules/async/timeout.js +89 -0
- package/dist/node_modules/archiver/node_modules/async/times.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/timesLimit.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/timesSeries.js +32 -0
- package/dist/node_modules/archiver/node_modules/async/transform.js +173 -0
- package/dist/node_modules/archiver/node_modules/async/tryEach.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/unmemoize.js +25 -0
- package/dist/node_modules/archiver/node_modules/async/until.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/waterfall.js +105 -0
- package/dist/node_modules/archiver/node_modules/async/whilst.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/wrapSync.js +118 -0
- package/dist/node_modules/archiver/package.json +1 -1
- package/dist/node_modules/decompress/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/moment/package.json +1 -1
- package/dist/node_modules/semver/bin/semver.js +7 -15
- package/dist/node_modules/semver/classes/range.js +28 -13
- package/dist/node_modules/semver/classes/semver.js +23 -7
- package/dist/node_modules/semver/functions/diff.js +5 -12
- package/dist/node_modules/semver/index.js +1 -1
- package/dist/node_modules/semver/internal/lrucache.js +40 -0
- package/dist/node_modules/semver/internal/re.js +2 -0
- package/dist/node_modules/semver/package.json +1 -1
- package/package.json +3 -3
- package/dist/client/04e68bac2ed0170d.js +0 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):(e="undefined"==typeof globalThis?e||self:globalThis,t(e.async={}))})(this,function(e){"use strict";function t(e,...t){return(...n)=>e(...t,...n)}function n(e){return function(...t){var n=t.pop();return e.call(this,t,n)}}function a(e){setTimeout(e,0)}function i(e){return(t,...n)=>e(()=>t(...n))}function r(e){return d(e)?function(...t){const n=t.pop(),a=e.apply(this,t);return s(a,n)}:n(function(t,n){var a;try{a=e.apply(this,t)}catch(t){return n(t)}return a&&"function"==typeof a.then?s(a,n):void n(null,a)})}function s(e,t){return e.then(e=>{l(t,null,e)},e=>{l(t,e&&(e instanceof Error||e.message)?e:new Error(e))})}function l(e,t,n){try{e(t,n)}catch(e){_e(t=>{throw t},e)}}function d(e){return"AsyncFunction"===e[Symbol.toStringTag]}function u(e){return"AsyncGenerator"===e[Symbol.toStringTag]}function p(e){return"function"==typeof e[Symbol.asyncIterator]}function c(e){if("function"!=typeof e)throw new Error("expected a function");return d(e)?r(e):e}function o(e,t){function n(...n){return"function"==typeof n[t-1]?e.apply(this,n):new Promise((a,i)=>{n[t-1]=(e,...t)=>e?i(e):void a(1<t.length?t:t[0]),e.apply(this,n)})}if(t||(t=e.length),!t)throw new Error("arity is undefined");return n}function h(e){return function a(t,...n){const i=o(function(a){var i=this;return e(t,(e,t)=>{c(e).apply(i,n.concat(t))},a)});return i}}function f(e,t,n,a){t=t||[];var i=[],r=0,s=c(n);return e(t,(e,t,n)=>{var a=r++;s(e,(e,t)=>{i[a]=t,n(e)})},e=>{a(e,i)})}function y(e){return e&&"number"==typeof e.length&&0<=e.length&&0==e.length%1}function m(e){function t(...t){if(null!==e){var n=e;e=null,n.apply(this,t)}}return Object.assign(t,e),t}function g(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}function k(e){var t=-1,n=e.length;return function a(){return++t<n?{value:e[t],key:t}:null}}function v(e){var t=-1;return function n(){var a=e.next();return a.done?null:(t++,{value:a.value,key:t})}}function S(e){var t=e?Object.keys(e):[],n=-1,a=t.length;return function i(){var r=t[++n];return"__proto__"===r?i():n<a?{value:e[r],key:r}:null}}function x(e){if(y(e))return k(e);var t=g(e);return t?v(t):S(e)}function L(e){return function(...t){if(null===e)throw new Error("Callback was already called.");var n=e;e=null,n.apply(this,t)}}function E(e,t,n,a){function i(){p>=t||u||l||(u=!0,e.next().then(({value:e,done:t})=>{if(!(d||l))return u=!1,t?(l=!0,void(0>=p&&a(null))):void(p++,n(e,c,r),c++,i())}).catch(s))}function r(e,t){return p-=1,d?void 0:e?s(e):!1===e?(l=!0,void(d=!0)):t===be||l&&0>=p?(l=!0,a(null)):void i()}function s(e){d||(u=!1,l=!0,a(e))}let l=!1,d=!1,u=!1,p=0,c=0;i()}function O(e,t,n){function a(e,t){!1===e&&(l=!0);!0===l||(e?n(e):(++r===s||t===be)&&n(null))}n=m(n);var i=0,r=0,{length:s}=e,l=!1;for(0===s&&n(null);i<s;i++)t(e[i],i,L(a))}function _(e,t,n){return Ie(e,1/0,t,n)}function b(){function e(e,...a){return e?n(e):void t(1<a.length?a:a[0])}let t,n;return e[Ce]=new Promise((e,a)=>{t=e,n=a}),e}function A(e,t,n){function a(e,t){k.push(()=>l(e,t))}function i(){if(!f){if(0===k.length&&0===h)return n(null,o);for(;k.length&&h<t;){var e=k.shift();e()}}}function r(e,t){var n=g[e];n||(n=g[e]=[]),n.push(t)}function s(e){var t=g[e]||[];t.forEach(e=>e()),i()}function l(e,t){if(!y){var a=L((t,...a)=>{if(h--,!1===t)return void(f=!0);if(2>a.length&&([a]=a),t){var i={};if(Object.keys(o).forEach(e=>{i[e]=o[e]}),i[e]=a,y=!0,g=Object.create(null),f)return;n(t,i)}else o[e]=a,s(e)});h++;var i=c(t[t.length-1]);1<t.length?i(o,a):i(a)}}function d(){for(var e,t=0;v.length;)e=v.pop(),t++,u(e).forEach(e=>{0==--S[e]&&v.push(e)});if(t!==p)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function u(t){var n=[];return Object.keys(e).forEach(a=>{const i=e[a];Array.isArray(i)&&0<=i.indexOf(t)&&n.push(a)}),n}"number"!=typeof t&&(n=t,t=null),n=m(n||b());var p=Object.keys(e).length;if(!p)return n(null);t||(t=p);var o={},h=0,f=!1,y=!1,g=Object.create(null),k=[],v=[],S={};return Object.keys(e).forEach(t=>{var n=e[t];if(!Array.isArray(n))return a(t,[n]),void v.push(t);var i=n.slice(0,n.length-1),s=i.length;return 0===s?(a(t,n),void v.push(t)):void(S[t]=s,i.forEach(l=>{if(!e[l])throw new Error("async.auto task `"+t+"` has a non-existent dependency `"+l+"` in "+i.join(", "));r(l,()=>{s--,0===s&&a(t,n)})}))}),d(),i(),n[Ce]}function I(e){let t="",n=0,a=e.indexOf("*/");for(;n<e.length;)if("/"===e[n]&&"/"===e[n+1]){let t=e.indexOf("\n",n);n=-1===t?e.length:t}else if(-1!==a&&"/"===e[n]&&"*"===e[n+1]){let i=e.indexOf("*/",n);-1===i?(t+=e[n],n++):(n=i+2,a=e.indexOf("*/",n))}else t+=e[n],n++;return t}function M(e){const t=I(e.toString());let n=t.match(Pe);if(n||(n=t.match(Re)),!n)throw new Error("could not parse args in autoInject\nSource:\n"+t);let[,a]=n;return a.replace(/\s/g,"").split(ze).map(e=>e.replace(Ne,"").trim())}function j(e,t){var n={};return Object.keys(e).forEach(t=>{function a(e,t){var n=i.map(t=>e[t]);n.push(t),c(r)(...n)}var i,r=e[t],s=d(r),l=!s&&1===r.length||s&&0===r.length;if(Array.isArray(r))i=[...r],r=i.pop(),n[t]=i.concat(0<i.length?a:r);else if(l)n[t]=r;else{if(i=M(r),0===r.length&&!s&&0===i.length)throw new Error("autoInject task functions require explicit parameters.");s||i.pop(),n[t]=i.concat(a)}}),A(n,t)}function w(e,t){e.length=1,e.head=e.tail=t}function B(e,t,n){function a(e,t){f[e].push(t)}function i(e,t){const n=(...a)=>{r(e,n),t(...a)};f[e].push(n)}function r(e,t){return e?t?void(f[e]=f[e].filter(e=>e!==t)):f[e]=[]:Object.keys(f).forEach(e=>f[e]=[])}function s(e,...t){f[e].forEach(e=>e(...t))}function l(e,t,n,a){function i(e,...t){return e?n?s(e):r():1>=t.length?r(t[0]):void r(t)}if(null!=a&&"function"!=typeof a)throw new Error("task callback must be a function");k.started=!0;var r,s,l=k._createTaskItem(e,n?i:a||i);if(t?k._tasks.unshift(l):k._tasks.push(l),y||(y=!0,_e(()=>{y=!1,k.process()})),n||!a)return new Promise((e,t)=>{r=e,s=t})}function d(e){return function(t,...n){o-=1;for(var a=0,r=e.length;a<r;a++){var l=e[a],d=h.indexOf(l);0===d?h.shift():0<d&&h.splice(d,1),l.callback(t,...n),null!=t&&s("error",t,l.data)}o<=k.concurrency-k.buffer&&s("unsaturated"),k.idle()&&s("drain"),k.process()}}function u(e){return!!(0===e.length&&k.idle())&&(_e(()=>s("drain")),!0)}if(null==t)t=1;else if(0===t)throw new RangeError("Concurrency must not be zero");var p=c(e),o=0,h=[];const f={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};var y=!1;const m=e=>t=>t?void(r(e),a(e,t)):new Promise((t,n)=>{i(e,(e,a)=>e?n(e):void t(a))});var g=!1,k={_tasks:new Ve,_createTaskItem(e,t){return{data:e,callback:t}},*[Symbol.iterator](){yield*k._tasks[Symbol.iterator]()},concurrency:t,payload:n,buffer:t/4,started:!1,paused:!1,push(e,t){return Array.isArray(e)?u(e)?void 0:e.map(e=>l(e,!1,!1,t)):l(e,!1,!1,t)},pushAsync(e,t){return Array.isArray(e)?u(e)?void 0:e.map(e=>l(e,!1,!0,t)):l(e,!1,!0,t)},kill(){r(),k._tasks.empty()},unshift(e,t){return Array.isArray(e)?u(e)?void 0:e.map(e=>l(e,!0,!1,t)):l(e,!0,!1,t)},unshiftAsync(e,t){return Array.isArray(e)?u(e)?void 0:e.map(e=>l(e,!0,!0,t)):l(e,!0,!0,t)},remove(e){k._tasks.remove(e)},process(){var e=Math.min;if(!g){for(g=!0;!k.paused&&o<k.concurrency&&k._tasks.length;){var t=[],n=[],a=k._tasks.length;k.payload&&(a=e(a,k.payload));for(var r,u=0;u<a;u++)r=k._tasks.shift(),t.push(r),h.push(r),n.push(r.data);o+=1,0===k._tasks.length&&s("empty"),o===k.concurrency&&s("saturated");var c=L(d(t));p(n,c)}g=!1}},length(){return k._tasks.length},running(){return o},workersList(){return h},idle(){return 0===k._tasks.length+o},pause(){k.paused=!0},resume(){!1===k.paused||(k.paused=!1,_e(k.process))}};return Object.defineProperties(k,{saturated:{writable:!1,value:m("saturated")},unsaturated:{writable:!1,value:m("unsaturated")},empty:{writable:!1,value:m("empty")},drain:{writable:!1,value:m("drain")},error:{writable:!1,value:m("error")}}),k}function T(e,t){return B(e,1,t)}function F(e,t,n){return B(e,t,n)}function C(...e){var t=e.map(c);return function(...e){var n=this,a=e[e.length-1];return"function"==typeof a?e.pop():a=b(),qe(t,e,(e,t,a)=>{t.apply(n,e.concat((e,...t)=>{a(e,t)}))},(e,t)=>a(e,...t)),a[Ce]}}function P(...e){return C(...e.reverse())}function R(...e){return function(...t){var n=t.pop();return n(null,...e)}}function z(e,t){return(n,a,i,r)=>{var s,l=!1;const d=c(i);n(a,(n,a,i)=>{d(n,(a,r)=>a||!1===a?i(a):e(r)&&!s?(l=!0,s=t(!0,n),i(null,be)):void i())},e=>e?r(e):void r(null,l?s:t(!1)))}}function N(e){return(t,...n)=>c(t)(...n,(t,...n)=>{"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&n.forEach(t=>console[e](t)))})}function V(e,t,n){const a=c(t);return Xe(e,(...e)=>{const t=e.pop();a(...e,(e,n)=>t(e,!n))},n)}function Y(e){return(t,n,a)=>e(t,a)}function q(e){return d(e)?e:function(...t){var n=t.pop(),a=!0;t.push((...e)=>{a?_e(()=>n(...e)):n(...e)}),e.apply(this,t),a=!1}}function D(e,t,n,a){var r=Array(t.length);e(t,(e,t,a)=>{n(e,(e,n)=>{r[t]=!!n,a(e)})},e=>{if(e)return a(e);for(var n=[],s=0;s<t.length;s++)r[s]&&n.push(t[s]);a(null,n)})}function Q(e,t,n,a){var i=[];e(t,(e,t,a)=>{n(e,(n,r)=>n?a(n):void(r&&i.push({index:t,value:e}),a(n)))},e=>e?a(e):void a(null,i.sort((e,t)=>e.index-t.index).map(e=>e.value)))}function U(e,t,n,a){var i=y(t)?D:Q;return i(e,t,c(n),a)}function G(e,t,n){return dt(e,1/0,t,n)}function W(e,t,n){return dt(e,1,t,n)}function H(e,t,n){return pt(e,1/0,t,n)}function J(e,t,n){return pt(e,1,t,n)}function K(e,t=e=>e){var a=Object.create(null),r=Object.create(null),s=c(e),l=n((e,n)=>{var d=t(...e);d in a?_e(()=>n(null,...a[d])):d in r?r[d].push(n):(r[d]=[n],s(...e,(e,...t)=>{e||(a[d]=t);var n=r[d];delete r[d];for(var s=0,u=n.length;s<u;s++)n[s](e,...t)}))});return l.memo=a,l.unmemoized=e,l}function X(e,t){return ot(Me,e,t)}function Z(e,t,n){return ot(Ae(t),e,n)}function $(e,t){var n=c(e);return B((e,t)=>{n(e[0],t)},t,1)}function ee(e){return(e<<1)+1}function te(e){return(e+1>>1)-1}function ne(e,t){return e.priority===t.priority?e.pushCount<t.pushCount:e.priority<t.priority}function ae(e,t){function n(e,t){return Array.isArray(e)?e.map(e=>({data:e,priority:t})):{data:e,priority:t}}var a=$(e,t),{push:i,pushAsync:r}=a;return a._tasks=new ht,a._createTaskItem=({data:e,priority:t},n)=>({data:e,priority:t,callback:n}),a.push=function(e,t=0,a){return i(n(e,t),a)},a.pushAsync=function(e,t=0,a){return r(n(e,t),a)},delete a.unshift,delete a.unshiftAsync,a}function ie(e,t,n,a){var i=[...e].reverse();return qe(i,t,n,a)}function re(e){var t=c(e);return n(function a(e,n){return e.push((e,...t)=>{let a={};if(e&&(a.error=e),0<t.length){var i=t;1>=t.length&&([i]=t),a.value=i}n(null,a)}),t.apply(this,e)})}function se(e){var t;return Array.isArray(e)?t=e.map(re):(t={},Object.keys(e).forEach(n=>{t[n]=re.call(this,e[n])})),t}function le(e,t,n,a){const i=c(n);return U(e,t,(e,t)=>{i(e,(e,n)=>{t(e,!n)})},a)}function de(e){return function(){return e}}function ue(e,t,n){function a(){r((e,...t)=>{!1===e||(e&&s++<i.times&&("function"!=typeof i.errorFilter||i.errorFilter(e))?setTimeout(a,i.intervalFunc(s-1)):n(e,...t))})}var i={times:kt,intervalFunc:de(vt)};if(3>arguments.length&&"function"==typeof e?(n=t||b(),t=e):(pe(i,e),n=n||b()),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var r=c(t),s=1;return a(),n[Ce]}function pe(e,n){if("object"==typeof n)e.times=+n.times||kt,e.intervalFunc="function"==typeof n.interval?n.interval:de(+n.interval||vt),e.errorFilter=n.errorFilter;else if("number"==typeof n||"string"==typeof n)e.times=+n||kt;else throw new Error("Invalid arguments for async.retry")}function ce(e,t){t||(t=e,e=null);let a=e&&e.arity||t.length;d(t)&&(a+=1);var i=c(t);return n((t,n)=>{function r(e){i(...t,e)}return(t.length<a-1||null==n)&&(t.push(n),n=b()),e?ue(e,r,n):ue(r,n),n[Ce]})}function oe(e,t){return ot(Be,e,t)}function he(e,t,a){var i=c(e);return n((n,r)=>{function s(){var t=e.name||"anonymous",n=new Error("Callback function \""+t+"\" timed out.");n.code="ETIMEDOUT",a&&(n.info=a),d=!0,r(n)}var l,d=!1;n.push((...e)=>{d||(r(...e),clearTimeout(l))}),l=setTimeout(s,t),i(...n)})}function fe(e){for(var t=Array(e);e--;)t[e]=e;return t}function ye(e,t,n,a){var i=c(n);return De(fe(e),t,i,a)}function me(e,t,n){return ye(e,1/0,t,n)}function ge(e,t,n){return ye(e,1,t,n)}function ke(e,t,n,a){3>=arguments.length&&"function"==typeof t&&(a=n,n=t,t=Array.isArray(e)?[]:{}),a=m(a||b());var i=c(n);return Me(e,(e,n,a)=>{i(t,e,n,a)},e=>a(e,t)),a[Ce]}function ve(e){return(...t)=>(e.unmemoized||e)(...t)}function Se(e,t,n){const a=c(e);return _t(e=>a((t,n)=>e(t,!n)),t,n)}var xe,Le="function"==typeof queueMicrotask&&queueMicrotask,Ee="function"==typeof setImmediate&&setImmediate,Oe="object"==typeof process&&"function"==typeof process.nextTick;xe=Le?queueMicrotask:Ee?setImmediate:Oe?process.nextTick:a;var _e=i(xe);var be={},Ae=e=>(t,n,a)=>{function i(e,t){if(!d)if(c-=1,e)l=!0,a(e);else if(!1===e)l=!0,d=!0;else{if(t===be||l&&0>=c)return l=!0,a(null);o||r()}}function r(){for(o=!0;c<e&&!l;){var t=s();if(null===t)return l=!0,void(0>=c&&a(null));c+=1,n(t.value,t.key,L(i))}o=!1}if(a=m(a),0>=e)throw new RangeError("concurrency limit cannot be less than 1");if(!t)return a(null);if(u(t))return E(t,e,n,a);if(p(t))return E(t[Symbol.asyncIterator](),e,n,a);var s=x(t),l=!1,d=!1,c=0,o=!1;r()},Ie=o(function i(e,t,n,a){return Ae(t)(e,c(n),a)},4),Me=o(function a(e,t,n){var i=y(e)?O:_;return i(e,c(t),n)},3),je=o(function a(e,t,n){return f(Me,e,t,n)},3),we=h(je),Be=o(function a(e,t,n){return Ie(e,1,t,n)},3),Te=o(function a(e,t,n){return f(Be,e,t,n)},3),Fe=h(Te);const Ce=Symbol("promiseCallback");var Pe=/^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/,Re=/^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/,ze=/,/,Ne=/(=.+)?(\s*)$/;class Ve{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1}insertBefore(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):w(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):w(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var t=this.head;t;){var{next:n}=t;e(t)&&this.removeLink(t),t=n}return this}}var Ye,qe=o(function i(e,t,n,a){a=m(a);var r=c(n);return Be(e,(e,n,a)=>{r(t,e,(e,n)=>{t=n,a(e)})},e=>a(e,t))},4),De=o(function i(e,t,n,a){return f(Ae(t),e,n,a)},4),Qe=o(function i(e,t,n,a){var r=c(n);return De(e,t,(e,t)=>{r(e,(e,...n)=>e?t(e):t(e,n))},(e,t)=>{for(var n=[],r=0;r<t.length;r++)t[r]&&(n=n.concat(...t[r]));return a(e,n)})},4),Ue=o(function a(e,t,n){return Qe(e,1/0,t,n)},3),Ge=o(function a(e,t,n){return Qe(e,1,t,n)},3),We=o(function a(e,t,n){return z(e=>e,(e,t)=>t)(Me,e,t,n)},3),He=o(function i(e,t,n,a){return z(e=>e,(e,t)=>t)(Ae(t),e,n,a)},4),Je=o(function a(e,t,n){return z(e=>e,(e,t)=>t)(Ae(1),e,t,n)},3),Ke=N("dir"),Xe=o(function a(e,t,n){function i(e,...t){return e?n(e):void(!1===e||(s=t,d(...t,r)))}function r(e,t){return e?n(e):!1===e?void 0:t?void l(i):n(null,...s)}n=L(n);var s,l=c(e),d=c(t);return r(null,!0)},3),Ze=o(function a(e,t,n){return Me(e,Y(c(t)),n)},3),$e=o(function i(e,t,n,a){return Ae(t)(e,Y(c(n)),a)},4),et=o(function a(e,t,n){return $e(e,1,t,n)},3),tt=o(function a(e,t,n){return z(e=>!e,e=>!e)(Me,e,t,n)},3),nt=o(function i(e,t,n,a){return z(e=>!e,e=>!e)(Ae(t),e,n,a)},4),at=o(function a(e,t,n){return z(e=>!e,e=>!e)(Be,e,t,n)},3),it=o(function a(e,t,n){return U(Me,e,t,n)},3),rt=o(function i(e,t,n,a){return U(Ae(t),e,n,a)},4),st=o(function a(e,t,n){return U(Be,e,t,n)},3),lt=o(function n(e,t){function a(e){return e?i(e):void(!1===e||r(a))}var i=L(t),r=c(q(e));return a()},2),dt=o(function i(e,t,n,a){var r=c(n);return De(e,t,(e,t)=>{r(e,(n,a)=>n?t(n):t(n,{key:a,val:e}))},(e,t)=>{for(var n={},{hasOwnProperty:r}=Object.prototype,s=0;s<t.length;s++)if(t[s]){var{key:l}=t[s],{val:d}=t[s];r.call(n,l)?n[l].push(d):n[l]=[d]}return a(e,n)})},4),ut=N("log"),pt=o(function i(e,t,n,a){a=m(a);var r={},s=c(n);return Ae(t)(e,(e,t,n)=>{s(e,t,(e,a)=>e?n(e):void(r[t]=a,n(e)))},e=>a(e,r))},4);Ye=Oe?process.nextTick:Ee?setImmediate:a;var ct=i(Ye),ot=o((e,t,n)=>{var a=y(t)?[]:{};e(t,(e,t,n)=>{c(e)((e,...i)=>{2>i.length&&([i]=i),a[t]=i,n(e)})},e=>n(e,a))},3);class ht{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(e){for(let n;0<e&&ne(this.heap[e],this.heap[n=te(e)]);){let a=this.heap[e];this.heap[e]=this.heap[n],this.heap[n]=a,e=n}}percDown(e){for(let n,a;(n=ee(e))<this.heap.length&&(n+1<this.heap.length&&ne(this.heap[n+1],this.heap[n])&&++n,!ne(this.heap[e],this.heap[n]));)a=this.heap[e],this.heap[e]=this.heap[n],this.heap[n]=a,e=n}push(e){e.pushCount=++this.pushCount,this.heap.push(e),this.percUp(this.heap.length-1)}unshift(e){return this.heap.push(e)}shift(){let[e]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),e}toArray(){return[...this]}*[Symbol.iterator](){for(let e=0;e<this.heap.length;e++)yield this.heap[e].data}remove(e){let t=0;for(let n=0;n<this.heap.length;n++)e(this.heap[n])||(this.heap[t]=this.heap[n],t++);this.heap.splice(t);for(let t=te(this.heap.length-1);0<=t;t--)this.percDown(t);return this}}var ft=o(function n(e,t){if(t=m(t),!Array.isArray(e))return t(new TypeError("First argument to race must be an array of functions"));if(!e.length)return t();for(var a=0,r=e.length;a<r;a++)c(e[a])(t)},2),yt=o(function a(e,t,n){return le(Me,e,t,n)},3),mt=o(function i(e,t,n,a){return le(Ae(t),e,n,a)},4),gt=o(function a(e,t,n){return le(Be,e,t,n)},3);const kt=5,vt=0;var St=o(function a(e,t,n){return z(Boolean,e=>e)(Me,e,t,n)},3),xt=o(function i(e,t,n,a){return z(Boolean,e=>e)(Ae(t),e,n,a)},4),Lt=o(function a(e,t,n){return z(Boolean,e=>e)(Be,e,t,n)},3),Et=o(function a(e,t,n){function i(e,t){var n=e.criteria,a=t.criteria;return n<a?-1:n>a?1:0}var r=c(t);return je(e,(e,t)=>{r(e,(n,a)=>n?t(n):void t(n,{value:e,criteria:a}))},(e,t)=>e?n(e):void n(null,t.sort(i).map(e=>e.value)))},3),Ot=o(function n(e,t){var a,i=null;return et(e,(e,t)=>{c(e)((e,...n)=>!1===e?t(e):void(2>n.length?[a]=n:a=n,i=e,t(e?null:{})))},()=>t(i,a))}),_t=o(function a(e,t,n){function i(e,...t){if(e)return n(e);d=t;!1===e||l(r)}function r(e,t){return e?n(e):!1===e?void 0:t?void s(i):n(null,...d)}n=L(n);var s=c(t),l=c(e),d=[];return l(r)},3),bt=o(function n(e,t){function a(t){var n=c(e[r++]);n(...t,L(i))}function i(n,...i){return!1===n?void 0:n||r===e.length?t(n,...i):void a(i)}if(t=m(t),!Array.isArray(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;a([])});e.all=tt,e.allLimit=nt,e.allSeries=at,e.any=St,e.anyLimit=xt,e.anySeries=Lt,e.apply=t,e.applyEach=we,e.applyEachSeries=Fe,e.asyncify=r,e.auto=A,e.autoInject=j,e.cargo=T,e.cargoQueue=F,e.compose=P,e.concat=Ue,e.concatLimit=Qe,e.concatSeries=Ge,e.constant=R,e.default={apply:t,applyEach:we,applyEachSeries:Fe,asyncify:r,auto:A,autoInject:j,cargo:T,cargoQueue:F,compose:P,concat:Ue,concatLimit:Qe,concatSeries:Ge,constant:R,detect:We,detectLimit:He,detectSeries:Je,dir:Ke,doUntil:V,doWhilst:Xe,each:Ze,eachLimit:$e,eachOf:Me,eachOfLimit:Ie,eachOfSeries:Be,eachSeries:et,ensureAsync:q,every:tt,everyLimit:nt,everySeries:at,filter:it,filterLimit:rt,filterSeries:st,forever:lt,groupBy:G,groupByLimit:dt,groupBySeries:W,log:ut,map:je,mapLimit:De,mapSeries:Te,mapValues:H,mapValuesLimit:pt,mapValuesSeries:J,memoize:K,nextTick:ct,parallel:X,parallelLimit:Z,priorityQueue:ae,queue:$,race:ft,reduce:qe,reduceRight:ie,reflect:re,reflectAll:se,reject:yt,rejectLimit:mt,rejectSeries:gt,retry:ue,retryable:ce,seq:C,series:oe,setImmediate:_e,some:St,someLimit:xt,someSeries:Lt,sortBy:Et,timeout:he,times:me,timesLimit:ye,timesSeries:ge,transform:ke,tryEach:Ot,unmemoize:ve,until:Se,waterfall:bt,whilst:_t,all:tt,allLimit:nt,allSeries:at,any:St,anyLimit:xt,anySeries:Lt,find:We,findLimit:He,findSeries:Je,flatMap:Ue,flatMapLimit:Qe,flatMapSeries:Ge,forEach:Ze,forEachSeries:et,forEachLimit:$e,forEachOf:Me,forEachOfSeries:Be,forEachOfLimit:Ie,inject:qe,foldl:qe,foldr:ie,select:it,selectLimit:rt,selectSeries:st,wrapSync:r,during:_t,doDuring:Xe},e.detect=We,e.detectLimit=He,e.detectSeries=Je,e.dir=Ke,e.doDuring=Xe,e.doUntil=V,e.doWhilst=Xe,e.during=_t,e.each=Ze,e.eachLimit=$e,e.eachOf=Me,e.eachOfLimit=Ie,e.eachOfSeries=Be,e.eachSeries=et,e.ensureAsync=q,e.every=tt,e.everyLimit=nt,e.everySeries=at,e.filter=it,e.filterLimit=rt,e.filterSeries=st,e.find=We,e.findLimit=He,e.findSeries=Je,e.flatMap=Ue,e.flatMapLimit=Qe,e.flatMapSeries=Ge,e.foldl=qe,e.foldr=ie,e.forEach=Ze,e.forEachLimit=$e,e.forEachOf=Me,e.forEachOfLimit=Ie,e.forEachOfSeries=Be,e.forEachSeries=et,e.forever=lt,e.groupBy=G,e.groupByLimit=dt,e.groupBySeries=W,e.inject=qe,e.log=ut,e.map=je,e.mapLimit=De,e.mapSeries=Te,e.mapValues=H,e.mapValuesLimit=pt,e.mapValuesSeries=J,e.memoize=K,e.nextTick=ct,e.parallel=X,e.parallelLimit=Z,e.priorityQueue=ae,e.queue=$,e.race=ft,e.reduce=qe,e.reduceRight=ie,e.reflect=re,e.reflectAll=se,e.reject=yt,e.rejectLimit=mt,e.rejectSeries=gt,e.retry=ue,e.retryable=ce,e.select=it,e.selectLimit=rt,e.selectSeries=st,e.seq=C,e.series=oe,e.setImmediate=_e,e.some=St,e.someLimit=xt,e.someSeries=Lt,e.sortBy=Et,e.timeout=he,e.times=me,e.timesLimit=ye,e.timesSeries=ge,e.transform=ke,e.tryEach=Ot,e.unmemoize=ve,e.until=Se,e.waterfall=bt,e.whilst=_t,e.wrapSync=r,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _onlyOnce = require('./internal/onlyOnce.js');
|
|
8
|
+
|
|
9
|
+
var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
|
|
10
|
+
|
|
11
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
12
|
+
|
|
13
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
14
|
+
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
|
+
|
|
17
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
|
+
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in
|
|
23
|
+
* the order of operations, the arguments `test` and `iteratee` are switched.
|
|
24
|
+
*
|
|
25
|
+
* `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
|
|
26
|
+
*
|
|
27
|
+
* @name doWhilst
|
|
28
|
+
* @static
|
|
29
|
+
* @memberOf module:ControlFlow
|
|
30
|
+
* @method
|
|
31
|
+
* @see [async.whilst]{@link module:ControlFlow.whilst}
|
|
32
|
+
* @category Control Flow
|
|
33
|
+
* @param {AsyncFunction} iteratee - A function which is called each time `test`
|
|
34
|
+
* passes. Invoked with (callback).
|
|
35
|
+
* @param {AsyncFunction} test - asynchronous truth test to perform after each
|
|
36
|
+
* execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
|
|
37
|
+
* non-error args from the previous callback of `iteratee`.
|
|
38
|
+
* @param {Function} [callback] - A callback which is called after the test
|
|
39
|
+
* function has failed and repeated execution of `iteratee` has stopped.
|
|
40
|
+
* `callback` will be passed an error and any arguments passed to the final
|
|
41
|
+
* `iteratee`'s callback. Invoked with (err, [results]);
|
|
42
|
+
* @returns {Promise} a promise, if no callback is passed
|
|
43
|
+
*/
|
|
44
|
+
function doWhilst(iteratee, test, callback) {
|
|
45
|
+
callback = (0, _onlyOnce2.default)(callback);
|
|
46
|
+
var _fn = (0, _wrapAsync2.default)(iteratee);
|
|
47
|
+
var _test = (0, _wrapAsync2.default)(test);
|
|
48
|
+
var results;
|
|
49
|
+
|
|
50
|
+
function next(err, ...args) {
|
|
51
|
+
if (err) return callback(err);
|
|
52
|
+
if (err === false) return;
|
|
53
|
+
results = args;
|
|
54
|
+
_test(...args, check);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function check(err, truth) {
|
|
58
|
+
if (err) return callback(err);
|
|
59
|
+
if (err === false) return;
|
|
60
|
+
if (!truth) return callback(null, ...results);
|
|
61
|
+
_fn(next);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return check(null, true);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
exports.default = (0, _awaitify2.default)(doWhilst, 3);
|
|
68
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = doUntil;
|
|
7
|
+
|
|
8
|
+
var _doWhilst = require('./doWhilst.js');
|
|
9
|
+
|
|
10
|
+
var _doWhilst2 = _interopRequireDefault(_doWhilst);
|
|
11
|
+
|
|
12
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
13
|
+
|
|
14
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the
|
|
20
|
+
* argument ordering differs from `until`.
|
|
21
|
+
*
|
|
22
|
+
* @name doUntil
|
|
23
|
+
* @static
|
|
24
|
+
* @memberOf module:ControlFlow
|
|
25
|
+
* @method
|
|
26
|
+
* @see [async.doWhilst]{@link module:ControlFlow.doWhilst}
|
|
27
|
+
* @category Control Flow
|
|
28
|
+
* @param {AsyncFunction} iteratee - An async function which is called each time
|
|
29
|
+
* `test` fails. Invoked with (callback).
|
|
30
|
+
* @param {AsyncFunction} test - asynchronous truth test to perform after each
|
|
31
|
+
* execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
|
|
32
|
+
* non-error args from the previous callback of `iteratee`
|
|
33
|
+
* @param {Function} [callback] - A callback which is called after the test
|
|
34
|
+
* function has passed and repeated execution of `iteratee` has stopped. `callback`
|
|
35
|
+
* will be passed an error and any arguments passed to the final `iteratee`'s
|
|
36
|
+
* callback. Invoked with (err, [results]);
|
|
37
|
+
* @returns {Promise} a promise, if no callback is passed
|
|
38
|
+
*/
|
|
39
|
+
function doUntil(iteratee, test, callback) {
|
|
40
|
+
const _test = (0, _wrapAsync2.default)(test);
|
|
41
|
+
return (0, _doWhilst2.default)(iteratee, (...args) => {
|
|
42
|
+
const cb = args.pop();
|
|
43
|
+
_test(...args, (err, truth) => cb(err, !truth));
|
|
44
|
+
}, callback);
|
|
45
|
+
}
|
|
46
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _onlyOnce = require('./internal/onlyOnce.js');
|
|
8
|
+
|
|
9
|
+
var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
|
|
10
|
+
|
|
11
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
12
|
+
|
|
13
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
14
|
+
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
|
+
|
|
17
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
|
+
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in
|
|
23
|
+
* the order of operations, the arguments `test` and `iteratee` are switched.
|
|
24
|
+
*
|
|
25
|
+
* `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
|
|
26
|
+
*
|
|
27
|
+
* @name doWhilst
|
|
28
|
+
* @static
|
|
29
|
+
* @memberOf module:ControlFlow
|
|
30
|
+
* @method
|
|
31
|
+
* @see [async.whilst]{@link module:ControlFlow.whilst}
|
|
32
|
+
* @category Control Flow
|
|
33
|
+
* @param {AsyncFunction} iteratee - A function which is called each time `test`
|
|
34
|
+
* passes. Invoked with (callback).
|
|
35
|
+
* @param {AsyncFunction} test - asynchronous truth test to perform after each
|
|
36
|
+
* execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
|
|
37
|
+
* non-error args from the previous callback of `iteratee`.
|
|
38
|
+
* @param {Function} [callback] - A callback which is called after the test
|
|
39
|
+
* function has failed and repeated execution of `iteratee` has stopped.
|
|
40
|
+
* `callback` will be passed an error and any arguments passed to the final
|
|
41
|
+
* `iteratee`'s callback. Invoked with (err, [results]);
|
|
42
|
+
* @returns {Promise} a promise, if no callback is passed
|
|
43
|
+
*/
|
|
44
|
+
function doWhilst(iteratee, test, callback) {
|
|
45
|
+
callback = (0, _onlyOnce2.default)(callback);
|
|
46
|
+
var _fn = (0, _wrapAsync2.default)(iteratee);
|
|
47
|
+
var _test = (0, _wrapAsync2.default)(test);
|
|
48
|
+
var results;
|
|
49
|
+
|
|
50
|
+
function next(err, ...args) {
|
|
51
|
+
if (err) return callback(err);
|
|
52
|
+
if (err === false) return;
|
|
53
|
+
results = args;
|
|
54
|
+
_test(...args, check);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function check(err, truth) {
|
|
58
|
+
if (err) return callback(err);
|
|
59
|
+
if (err === false) return;
|
|
60
|
+
if (!truth) return callback(null, ...results);
|
|
61
|
+
_fn(next);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return check(null, true);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
exports.default = (0, _awaitify2.default)(doWhilst, 3);
|
|
68
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _onlyOnce = require('./internal/onlyOnce.js');
|
|
8
|
+
|
|
9
|
+
var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
|
|
10
|
+
|
|
11
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
12
|
+
|
|
13
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
14
|
+
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
|
+
|
|
17
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
|
+
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when
|
|
23
|
+
* stopped, or an error occurs.
|
|
24
|
+
*
|
|
25
|
+
* @name whilst
|
|
26
|
+
* @static
|
|
27
|
+
* @memberOf module:ControlFlow
|
|
28
|
+
* @method
|
|
29
|
+
* @category Control Flow
|
|
30
|
+
* @param {AsyncFunction} test - asynchronous truth test to perform before each
|
|
31
|
+
* execution of `iteratee`. Invoked with (callback).
|
|
32
|
+
* @param {AsyncFunction} iteratee - An async function which is called each time
|
|
33
|
+
* `test` passes. Invoked with (callback).
|
|
34
|
+
* @param {Function} [callback] - A callback which is called after the test
|
|
35
|
+
* function has failed and repeated execution of `iteratee` has stopped. `callback`
|
|
36
|
+
* will be passed an error and any arguments passed to the final `iteratee`'s
|
|
37
|
+
* callback. Invoked with (err, [results]);
|
|
38
|
+
* @returns {Promise} a promise, if no callback is passed
|
|
39
|
+
* @example
|
|
40
|
+
*
|
|
41
|
+
* var count = 0;
|
|
42
|
+
* async.whilst(
|
|
43
|
+
* function test(cb) { cb(null, count < 5); },
|
|
44
|
+
* function iter(callback) {
|
|
45
|
+
* count++;
|
|
46
|
+
* setTimeout(function() {
|
|
47
|
+
* callback(null, count);
|
|
48
|
+
* }, 1000);
|
|
49
|
+
* },
|
|
50
|
+
* function (err, n) {
|
|
51
|
+
* // 5 seconds have passed, n = 5
|
|
52
|
+
* }
|
|
53
|
+
* );
|
|
54
|
+
*/
|
|
55
|
+
function whilst(test, iteratee, callback) {
|
|
56
|
+
callback = (0, _onlyOnce2.default)(callback);
|
|
57
|
+
var _fn = (0, _wrapAsync2.default)(iteratee);
|
|
58
|
+
var _test = (0, _wrapAsync2.default)(test);
|
|
59
|
+
var results = [];
|
|
60
|
+
|
|
61
|
+
function next(err, ...rest) {
|
|
62
|
+
if (err) return callback(err);
|
|
63
|
+
results = rest;
|
|
64
|
+
if (err === false) return;
|
|
65
|
+
_test(check);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function check(err, truth) {
|
|
69
|
+
if (err) return callback(err);
|
|
70
|
+
if (err === false) return;
|
|
71
|
+
if (!truth) return callback(null, ...results);
|
|
72
|
+
_fn(next);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return _test(check);
|
|
76
|
+
}
|
|
77
|
+
exports.default = (0, _awaitify2.default)(whilst, 3);
|
|
78
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _eachOf = require('./eachOf.js');
|
|
8
|
+
|
|
9
|
+
var _eachOf2 = _interopRequireDefault(_eachOf);
|
|
10
|
+
|
|
11
|
+
var _withoutIndex = require('./internal/withoutIndex.js');
|
|
12
|
+
|
|
13
|
+
var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
|
|
14
|
+
|
|
15
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
16
|
+
|
|
17
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
18
|
+
|
|
19
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
20
|
+
|
|
21
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Applies the function `iteratee` to each item in `coll`, in parallel.
|
|
27
|
+
* The `iteratee` is called with an item from the list, and a callback for when
|
|
28
|
+
* it has finished. If the `iteratee` passes an error to its `callback`, the
|
|
29
|
+
* main `callback` (for the `each` function) is immediately called with the
|
|
30
|
+
* error.
|
|
31
|
+
*
|
|
32
|
+
* Note, that since this function applies `iteratee` to each item in parallel,
|
|
33
|
+
* there is no guarantee that the iteratee functions will complete in order.
|
|
34
|
+
*
|
|
35
|
+
* @name each
|
|
36
|
+
* @static
|
|
37
|
+
* @memberOf module:Collections
|
|
38
|
+
* @method
|
|
39
|
+
* @alias forEach
|
|
40
|
+
* @category Collection
|
|
41
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
42
|
+
* @param {AsyncFunction} iteratee - An async function to apply to
|
|
43
|
+
* each item in `coll`. Invoked with (item, callback).
|
|
44
|
+
* The array index is not passed to the iteratee.
|
|
45
|
+
* If you need the index, use `eachOf`.
|
|
46
|
+
* @param {Function} [callback] - A callback which is called when all
|
|
47
|
+
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
|
48
|
+
* @returns {Promise} a promise, if a callback is omitted
|
|
49
|
+
* @example
|
|
50
|
+
*
|
|
51
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
52
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
53
|
+
* // dir3 is a directory that contains file5.txt
|
|
54
|
+
* // dir4 does not exist
|
|
55
|
+
*
|
|
56
|
+
* const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt'];
|
|
57
|
+
* const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt'];
|
|
58
|
+
*
|
|
59
|
+
* // asynchronous function that deletes a file
|
|
60
|
+
* const deleteFile = function(file, callback) {
|
|
61
|
+
* fs.unlink(file, callback);
|
|
62
|
+
* };
|
|
63
|
+
*
|
|
64
|
+
* // Using callbacks
|
|
65
|
+
* async.each(fileList, deleteFile, function(err) {
|
|
66
|
+
* if( err ) {
|
|
67
|
+
* console.log(err);
|
|
68
|
+
* } else {
|
|
69
|
+
* console.log('All files have been deleted successfully');
|
|
70
|
+
* }
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* // Error Handling
|
|
74
|
+
* async.each(withMissingFileList, deleteFile, function(err){
|
|
75
|
+
* console.log(err);
|
|
76
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
77
|
+
* // since dir4/file2.txt does not exist
|
|
78
|
+
* // dir1/file1.txt could have been deleted
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* // Using Promises
|
|
82
|
+
* async.each(fileList, deleteFile)
|
|
83
|
+
* .then( () => {
|
|
84
|
+
* console.log('All files have been deleted successfully');
|
|
85
|
+
* }).catch( err => {
|
|
86
|
+
* console.log(err);
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* // Error Handling
|
|
90
|
+
* async.each(fileList, deleteFile)
|
|
91
|
+
* .then( () => {
|
|
92
|
+
* console.log('All files have been deleted successfully');
|
|
93
|
+
* }).catch( err => {
|
|
94
|
+
* console.log(err);
|
|
95
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
96
|
+
* // since dir4/file2.txt does not exist
|
|
97
|
+
* // dir1/file1.txt could have been deleted
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* // Using async/await
|
|
101
|
+
* async () => {
|
|
102
|
+
* try {
|
|
103
|
+
* await async.each(files, deleteFile);
|
|
104
|
+
* }
|
|
105
|
+
* catch (err) {
|
|
106
|
+
* console.log(err);
|
|
107
|
+
* }
|
|
108
|
+
* }
|
|
109
|
+
*
|
|
110
|
+
* // Error Handling
|
|
111
|
+
* async () => {
|
|
112
|
+
* try {
|
|
113
|
+
* await async.each(withMissingFileList, deleteFile);
|
|
114
|
+
* }
|
|
115
|
+
* catch (err) {
|
|
116
|
+
* console.log(err);
|
|
117
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
118
|
+
* // since dir4/file2.txt does not exist
|
|
119
|
+
* // dir1/file1.txt could have been deleted
|
|
120
|
+
* }
|
|
121
|
+
* }
|
|
122
|
+
*
|
|
123
|
+
*/
|
|
124
|
+
function eachLimit(coll, iteratee, callback) {
|
|
125
|
+
return (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
exports.default = (0, _awaitify2.default)(eachLimit, 3);
|
|
129
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
|
8
|
+
|
|
9
|
+
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
|
10
|
+
|
|
11
|
+
var _withoutIndex = require('./internal/withoutIndex.js');
|
|
12
|
+
|
|
13
|
+
var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
|
|
14
|
+
|
|
15
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
16
|
+
|
|
17
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
18
|
+
|
|
19
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
20
|
+
|
|
21
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
|
|
27
|
+
*
|
|
28
|
+
* @name eachLimit
|
|
29
|
+
* @static
|
|
30
|
+
* @memberOf module:Collections
|
|
31
|
+
* @method
|
|
32
|
+
* @see [async.each]{@link module:Collections.each}
|
|
33
|
+
* @alias forEachLimit
|
|
34
|
+
* @category Collection
|
|
35
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
36
|
+
* @param {number} limit - The maximum number of async operations at a time.
|
|
37
|
+
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
|
38
|
+
* `coll`.
|
|
39
|
+
* The array index is not passed to the iteratee.
|
|
40
|
+
* If you need the index, use `eachOfLimit`.
|
|
41
|
+
* Invoked with (item, callback).
|
|
42
|
+
* @param {Function} [callback] - A callback which is called when all
|
|
43
|
+
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
|
44
|
+
* @returns {Promise} a promise, if a callback is omitted
|
|
45
|
+
*/
|
|
46
|
+
function eachLimit(coll, limit, iteratee, callback) {
|
|
47
|
+
return (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
|
|
48
|
+
}
|
|
49
|
+
exports.default = (0, _awaitify2.default)(eachLimit, 4);
|
|
50
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _isArrayLike = require('./internal/isArrayLike.js');
|
|
8
|
+
|
|
9
|
+
var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
|
|
10
|
+
|
|
11
|
+
var _breakLoop = require('./internal/breakLoop.js');
|
|
12
|
+
|
|
13
|
+
var _breakLoop2 = _interopRequireDefault(_breakLoop);
|
|
14
|
+
|
|
15
|
+
var _eachOfLimit = require('./eachOfLimit.js');
|
|
16
|
+
|
|
17
|
+
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
|
18
|
+
|
|
19
|
+
var _once = require('./internal/once.js');
|
|
20
|
+
|
|
21
|
+
var _once2 = _interopRequireDefault(_once);
|
|
22
|
+
|
|
23
|
+
var _onlyOnce = require('./internal/onlyOnce.js');
|
|
24
|
+
|
|
25
|
+
var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
|
|
26
|
+
|
|
27
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
28
|
+
|
|
29
|
+
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
30
|
+
|
|
31
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
32
|
+
|
|
33
|
+
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
34
|
+
|
|
35
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
|
+
|
|
37
|
+
// eachOf implementation optimized for array-likes
|
|
38
|
+
function eachOfArrayLike(coll, iteratee, callback) {
|
|
39
|
+
callback = (0, _once2.default)(callback);
|
|
40
|
+
var index = 0,
|
|
41
|
+
completed = 0,
|
|
42
|
+
{ length } = coll,
|
|
43
|
+
canceled = false;
|
|
44
|
+
if (length === 0) {
|
|
45
|
+
callback(null);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function iteratorCallback(err, value) {
|
|
49
|
+
if (err === false) {
|
|
50
|
+
canceled = true;
|
|
51
|
+
}
|
|
52
|
+
if (canceled === true) return;
|
|
53
|
+
if (err) {
|
|
54
|
+
callback(err);
|
|
55
|
+
} else if (++completed === length || value === _breakLoop2.default) {
|
|
56
|
+
callback(null);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
for (; index < length; index++) {
|
|
61
|
+
iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// a generic version of eachOf which can handle array, object, and iterator cases.
|
|
66
|
+
function eachOfGeneric(coll, iteratee, callback) {
|
|
67
|
+
return (0, _eachOfLimit2.default)(coll, Infinity, iteratee, callback);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument
|
|
72
|
+
* to the iteratee.
|
|
73
|
+
*
|
|
74
|
+
* @name eachOf
|
|
75
|
+
* @static
|
|
76
|
+
* @memberOf module:Collections
|
|
77
|
+
* @method
|
|
78
|
+
* @alias forEachOf
|
|
79
|
+
* @category Collection
|
|
80
|
+
* @see [async.each]{@link module:Collections.each}
|
|
81
|
+
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
|
82
|
+
* @param {AsyncFunction} iteratee - A function to apply to each
|
|
83
|
+
* item in `coll`.
|
|
84
|
+
* The `key` is the item's key, or index in the case of an array.
|
|
85
|
+
* Invoked with (item, key, callback).
|
|
86
|
+
* @param {Function} [callback] - A callback which is called when all
|
|
87
|
+
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
|
88
|
+
* @returns {Promise} a promise, if a callback is omitted
|
|
89
|
+
* @example
|
|
90
|
+
*
|
|
91
|
+
* // dev.json is a file containing a valid json object config for dev environment
|
|
92
|
+
* // dev.json is a file containing a valid json object config for test environment
|
|
93
|
+
* // prod.json is a file containing a valid json object config for prod environment
|
|
94
|
+
* // invalid.json is a file with a malformed json object
|
|
95
|
+
*
|
|
96
|
+
* let configs = {}; //global variable
|
|
97
|
+
* let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'};
|
|
98
|
+
* let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'};
|
|
99
|
+
*
|
|
100
|
+
* // asynchronous function that reads a json file and parses the contents as json object
|
|
101
|
+
* function parseFile(file, key, callback) {
|
|
102
|
+
* fs.readFile(file, "utf8", function(err, data) {
|
|
103
|
+
* if (err) return calback(err);
|
|
104
|
+
* try {
|
|
105
|
+
* configs[key] = JSON.parse(data);
|
|
106
|
+
* } catch (e) {
|
|
107
|
+
* return callback(e);
|
|
108
|
+
* }
|
|
109
|
+
* callback();
|
|
110
|
+
* });
|
|
111
|
+
* }
|
|
112
|
+
*
|
|
113
|
+
* // Using callbacks
|
|
114
|
+
* async.forEachOf(validConfigFileMap, parseFile, function (err) {
|
|
115
|
+
* if (err) {
|
|
116
|
+
* console.error(err);
|
|
117
|
+
* } else {
|
|
118
|
+
* console.log(configs);
|
|
119
|
+
* // configs is now a map of JSON data, e.g.
|
|
120
|
+
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
121
|
+
* }
|
|
122
|
+
* });
|
|
123
|
+
*
|
|
124
|
+
* //Error handing
|
|
125
|
+
* async.forEachOf(invalidConfigFileMap, parseFile, function (err) {
|
|
126
|
+
* if (err) {
|
|
127
|
+
* console.error(err);
|
|
128
|
+
* // JSON parse error exception
|
|
129
|
+
* } else {
|
|
130
|
+
* console.log(configs);
|
|
131
|
+
* }
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* // Using Promises
|
|
135
|
+
* async.forEachOf(validConfigFileMap, parseFile)
|
|
136
|
+
* .then( () => {
|
|
137
|
+
* console.log(configs);
|
|
138
|
+
* // configs is now a map of JSON data, e.g.
|
|
139
|
+
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
140
|
+
* }).catch( err => {
|
|
141
|
+
* console.error(err);
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* //Error handing
|
|
145
|
+
* async.forEachOf(invalidConfigFileMap, parseFile)
|
|
146
|
+
* .then( () => {
|
|
147
|
+
* console.log(configs);
|
|
148
|
+
* }).catch( err => {
|
|
149
|
+
* console.error(err);
|
|
150
|
+
* // JSON parse error exception
|
|
151
|
+
* });
|
|
152
|
+
*
|
|
153
|
+
* // Using async/await
|
|
154
|
+
* async () => {
|
|
155
|
+
* try {
|
|
156
|
+
* let result = await async.forEachOf(validConfigFileMap, parseFile);
|
|
157
|
+
* console.log(configs);
|
|
158
|
+
* // configs is now a map of JSON data, e.g.
|
|
159
|
+
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
160
|
+
* }
|
|
161
|
+
* catch (err) {
|
|
162
|
+
* console.log(err);
|
|
163
|
+
* }
|
|
164
|
+
* }
|
|
165
|
+
*
|
|
166
|
+
* //Error handing
|
|
167
|
+
* async () => {
|
|
168
|
+
* try {
|
|
169
|
+
* let result = await async.forEachOf(invalidConfigFileMap, parseFile);
|
|
170
|
+
* console.log(configs);
|
|
171
|
+
* }
|
|
172
|
+
* catch (err) {
|
|
173
|
+
* console.log(err);
|
|
174
|
+
* // JSON parse error exception
|
|
175
|
+
* }
|
|
176
|
+
* }
|
|
177
|
+
*
|
|
178
|
+
*/
|
|
179
|
+
function eachOf(coll, iteratee, callback) {
|
|
180
|
+
var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric;
|
|
181
|
+
return eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
exports.default = (0, _awaitify2.default)(eachOf, 3);
|
|
185
|
+
module.exports = exports.default;
|