@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 2.47 kB
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import i from"./../define-nonenumerable-read-only-property.js";import r from"./../../assert/is-function.js";import t from"./../../assert/is-collection.js";import e from"./../../constants/math/float64-pinf.js";import n from"./../../assert/is-plain-object.js";import o from"./../../assert/has-own-property.js";import s from"./../../assert/is-boolean.js";import l from"./../../assert/is-positive-integer.js";import a from"./../../vendor/debug.js";var m=n,u=o,f=s.isPrimitive,c=l.isPrimitive;function p(i,r){return m(r)?(u(r,"thisArg")&&(i.thisArg=r.thisArg),u(r,"series")&&(i.series=r.series,!f(i.series))?new TypeError("invalid option. `series` option must be a boolean primitive. Option: `"+i.series+"`."):u(r,"limit")&&(i.limit=r.limit,!c(i.limit))?new TypeError("invalid option. `limit` option must be a positive integer. Option: `"+i.limit+"`."):null):new TypeError("invalid argument. Options must be an object. Value: `"+r+"`.")}var g=a,d=g("inmap-right-async:limit");function h(i,r,t,e){var n,o,s,l,a,m;if(l=i.length,d("Collection length: %d",l),0===l)return d("Finished processing a collection."),e();for(s=l<r.limit?l:r.limit,d("Concurrency limit: %d",s),d("Number of arguments: %d",t.length),n=0,a=l,m=0;m<s;m++)a>0&&u();function u(){var e;function n(r,t){if(!o){if(r)return o=!0,f(r);i[e]=t,f()}}d("Collection element %d: %s.",e=a-=1,JSON.stringify(i[e])),2===t.length?t.call(r.thisArg,i[e],n):3===t.length?t.call(r.thisArg,i[e],e,n):t.call(r.thisArg,i[e],e,i,n)}function f(i){return i?(d("Encountered an error: %s",i.message),e(i)):(d("Processed %d of %d collection elements.",n+=1,l),a>0?u():n===l?(d("Finished processing a collection."),e()):void 0)}}var v=r,b=t,y=e,j=p,w=h;function E(i,r){var t,e,n;if(t={},arguments.length>1){if(e=j(t,i))throw e;n=r}else n=i;if(!v(n))throw new TypeError("invalid argument. Last argument must be a function. Value: `"+n+"`.");return t.series?t.limit=1:t.limit||(t.limit=y),o;function o(i,r){if(!b(i))throw new TypeError("invalid argument. First argument must be a collection. Value: `"+i+".`");if(!v(r))throw new TypeError("invalid argument. Last argument must be a function. Value: `"+r+"`.");return w(i,t,n,(function(t){if(t)return r(t,i);r(null,i)}))}}var A=E;function T(i,r,t,e){if(arguments.length<4)return A(r)(i,t);A(r,t)(i,e)}var O=i,V=T,C=E;O(V,"factory",C);export default V;
//# sourceMappingURL=inmap-right.js.map