UNPKG

npm-check-updates

Version:

Find newer versions of dependencies than what your package.json allows

3 lines (2 loc) 1.57 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function N(n,I,{concurrency:o=Number.POSITIVE_INFINITY,stopOnError:b=!0,signal:i}={}){return new Promise((E,g)=>{if(n[Symbol.iterator]===void 0&&n[Symbol.asyncIterator]===void 0)throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof n})`);if(typeof I!="function")throw new TypeError("Mapper function is required");if(!(Number.isSafeInteger(o)&&o>=1||o===Number.POSITIVE_INFINITY))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${o}\` (${typeof o})`);const c=[],p=[],d=new Map;let w=!1,s=!1,m=!1,f=0,S=0;const T=n[Symbol.iterator]===void 0?n[Symbol.asyncIterator]():n[Symbol.iterator](),h=()=>{a(i.reason)},v=()=>{i?.removeEventListener("abort",h)},x=e=>{E(e),v()},a=e=>{w=!0,s=!0,g(e),v()};i&&(i.aborted&&a(i.reason),i.addEventListener("abort",h,{once:!0}));const l=async()=>{if(s)return;const e=await T.next(),u=S;if(S++,e.done){if(m=!0,f===0&&!s){if(!b&&p.length>0){a(new AggregateError(p));return}if(s=!0,d.size===0){x(c);return}const t=[];for(const[r,M]of c.entries())d.get(r)!==y&&t.push(M);x(t)}return}f++,(async()=>{try{const t=await e.value;if(s)return;const r=await I(t,u);r===y&&d.set(u,r),c[u]=r,f--,await l()}catch(t){if(b)a(t);else{p.push(t),f--;try{await l()}catch(r){a(r)}}}})()};(async()=>{for(let e=0;e<o;e++){try{await l()}catch(u){a(u);break}if(m||w)break}})()})}const y=Symbol("skip");exports.default=N;exports.pMapSkip=y; //# sourceMappingURL=index-CG9irf3b.js.map