it-parallel-batch
Advanced tools
Comparing version 3.0.0 to 3.0.1
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.ItParallelBatch = factory()}(typeof self !== 'undefined' ? self : this, function () { | ||
"use strict";var ItParallelBatch=(()=>{var c=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var u=(a,t)=>{for(var l in t)c(a,l,{get:t[l],enumerable:!0})},w=(a,t,l,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of f(t))!s.call(a,e)&&e!==l&&c(a,e,{get:()=>t[e],enumerable:!(n=h(t,e))||n.enumerable});return a};var g=a=>w(c({},"__esModule",{value:!0}),a);var p={};u(p,{default:()=>r});async function*i(a,t=1){let l=[];t<1&&(t=1);for await(let n of a)for(l.push(n);l.length>=t;)yield l.slice(0,t),l=l.slice(t);for(;l.length>0;)yield l.slice(0,t),l=l.slice(t)}async function*r(a,t=1){for await(let l of i(a,t)){let n=l.map(async e=>await e().then(o=>({ok:!0,value:o}),o=>({ok:!1,err:o})));for(let e=0;e<n.length;e++){let o=await n[e];if(o.ok)yield o.value;else throw o.err}}}return g(p);})(); | ||
"use strict";var ItParallelBatch=(()=>{var a=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var g=(l,t)=>{for(var n in t)a(l,n,{get:t[n],enumerable:!0})},s=(l,t,n,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of f(t))!u.call(l,r)&&r!==n&&a(l,r,{get:()=>t[r],enumerable:!(e=i(t,r))||e.enumerable});return l};var w=l=>s(a({},"__esModule",{value:!0}),l);var b={};g(b,{default:()=>c});function y(l){return l[Symbol.asyncIterator]!=null}function d(l,t=1){return t=Number(t),y(l)?async function*(){let n=[];if(t<1&&(t=1),t!==Math.round(t))throw new Error("Batch size must be an integer");for await(let e of l)for(n.push(e);n.length>=t;)yield n.slice(0,t),n=n.slice(t);for(;n.length>0;)yield n.slice(0,t),n=n.slice(t)}():function*(){let n=[];if(t<1&&(t=1),t!==Math.round(t))throw new Error("Batch size must be an integer");for(let e of l)for(n.push(e);n.length>=t;)yield n.slice(0,t),n=n.slice(t);for(;n.length>0;)yield n.slice(0,t),n=n.slice(t)}()}var h=d;async function*c(l,t=1){for await(let n of h(l,t)){let e=n.map(async r=>r().then(o=>({ok:!0,value:o}),o=>({ok:!1,err:o})));for(let r=0;r<e.length;r++){let o=await e[r];if(o.ok)yield o.value;else throw o.err}}}return w(b);})(); | ||
return ItParallelBatch})); |
@@ -10,3 +10,3 @@ import batch from 'it-batch'; | ||
const things = tasks.map(async (p) => { | ||
return await p().then(value => ({ ok: true, value }), err => ({ ok: false, err })); | ||
return p().then(value => ({ ok: true, value }), err => ({ ok: false, err })); | ||
}); | ||
@@ -13,0 +13,0 @@ for (let i = 0; i < things.length; i++) { |
{ | ||
"name": "it-parallel-batch", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input", | ||
@@ -141,3 +141,3 @@ "author": "Alex Potsides <alex@achingbrain.net>", | ||
"devDependencies": { | ||
"aegir": "^38.1.7", | ||
"aegir": "^39.0.2", | ||
"delay": "^5.0.0", | ||
@@ -144,0 +144,0 @@ "it-all": "^3.0.0" |
@@ -22,3 +22,3 @@ import batch from 'it-batch' | ||
async (p: () => Promise<T>) => { | ||
return await p().then(value => ({ ok: true, value }), err => ({ ok: false, err })) | ||
return p().then(value => ({ ok: true, value }), err => ({ ok: false, err })) | ||
}) | ||
@@ -25,0 +25,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10537
65