Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pjobs

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pjobs - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

dist/index.d.ts

@@ -31,3 +31,3 @@ // Generated by dts-bundle-generator v6.9.0

forEach<T>(items: T[], fn: (item: T, currentIndex: number, array: T[]) => Promise<void>): Promise<void>;
map<T>(items: T[], fn: (item: T, currentIndex: number, array: T[]) => Promise<T>): Promise<T[]>;
map<U, T>(items: T[], fn: (item: T, currentIndex: number, array: T[]) => Promise<U>): Promise<U[]>;
reduce<U, T>(items: T[], fn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => Promise<U>, initialValue: U): Promise<U>;

@@ -34,0 +34,0 @@ some<T>(items: T[], fn: (item: T, currentIndex: number, array: T[]) => Promise<boolean>): Promise<T | undefined>;

@@ -1,1 +0,1 @@

var w=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var F=(t,o)=>{for(var a in o)w(t,a,{get:o[a],enumerable:!0})},q=(t,o,a,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let u of S(o))!z.call(t,u)&&u!==a&&w(t,u,{get:()=>o[u],enumerable:!(s=Q(o,u))||s.enumerable});return t};var I=t=>q(w({},"__esModule",{value:!0}),t);var k={};F(k,{asap:()=>U,defer:()=>J,queuePromises:()=>j,sleep:()=>V});module.exports=I(k);function V(t){return new Promise(o=>{setTimeout(o,t)})}function J(){let t,o;return{promise:new Promise((s,u)=>{t=s,o=u}),resolve(s){t&&t(s)},reject(s){o&&o(s)}}}function U(t){setTimeout(()=>t(),1)}function j(t){let o=Math.max(1,t?.concurrency||1),a=t?.onProgress,s=[],u=0,l=!0,c=[],d=0,y=0,g,v=0,p,T=0;return{state(){return l?"idle":D()},enqueue(e){Array.isArray(e)?(s.push(...e),u+=e.length):(s.push(e),u++),y=Date.now()+1e3,x()},promise(e){if(Array.isArray(e))return Promise.all(e.map(r=>this.promise(r)));let i=J();return this.enqueue(()=>e().then(i.resolve,i.reject)),i.promise},forEach(e,i){return Promise.all(e.map((r,n,m)=>this.promise(()=>i(r,n,m)))).then(()=>{})},map(e,i){return Promise.all(e.map((r,n,m)=>this.promise(()=>i(r,n,m))))},reduce(e,i,r){let n=r;return Promise.all(e.map((m,f,P)=>this.promise(()=>i(n,m,f,P).then(h=>{n=h})))).then(()=>n)},some(e,i){let r=!1;return new Promise((n,m)=>{Promise.all(e.map((f,P,h)=>this.promise(()=>r?Promise.resolve():i(f,P,h).then(R=>{R&&(r=!0,n(f))},m)))).then(()=>{r||n(void 0)})})},waitFor(){return new Promise((e,i)=>{setTimeout(r,100);function r(){l?(p?i(p):e(),p=void 0):setTimeout(r,100)}})},setConcurrency(e){o=Math.max(e,1),x()},forceState(e){c=[[e.start,0]],y=e.canRate,u=e.size,T=e.done}};function x(){l&&(c=[[Date.now(),0]],l=!1),s.length?A():d<1?(u=0,T=0,l=!0,b(),setTimeout(()=>{p=void 0},2e3)):b()}function b(){l||Date.now()>v?U(e):(g&&clearTimeout(g),g=setTimeout(b,1e3));function e(){Date.now()<v||a&&(v=Date.now()+1e3,u>0?a(D()):a("idle"))}}function A(){for(;d<o;){let e=s.shift();if(!e)break;d++,b(),e().catch(i=>{p=i}).finally(()=>{T++,d--,b(),x()})}}function D(){return{get size(){return u},get running(){return d},get pending(){return s.length},get done(){return T},get percent(){return Math.round(T/u*1e3)/10},get rate(){return e()||"-"},get timeRemaining(){return i()}};function e(){let r=Date.now();if(r<y)return!1;let n=T+d,m=c[0][1],f=n-m;if(f<=0)return!1;for(c.push([r,n]);c.length>30;)c=c.slice(c.length-30);let P=c[0][0],h=(r-P)/1e3;return f/h}function i(){let r=e();if(r===!1)return"-";let n=(d+s.length)/r;if(n<2)return"one second";if(n<50)return`${n.toFixed(0)} seconds`;if(n<120)return"one minute";let m=n/60;if(m<60)return`${m.toFixed(0)} minutes`;let f=m/60;return m<120?"one hour":`${f.toFixed(0)} hours`}}}0&&(module.exports={asap,defer,queuePromises,sleep});
var w=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var F=(t,o)=>{for(var a in o)w(t,a,{get:o[a],enumerable:!0})},q=(t,o,a,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let u of S(o))!z.call(t,u)&&u!==a&&w(t,u,{get:()=>o[u],enumerable:!(s=Q(o,u))||s.enumerable});return t};var I=t=>q(w({},"__esModule",{value:!0}),t);var k={};F(k,{asap:()=>J,defer:()=>U,queuePromises:()=>j,sleep:()=>V});module.exports=I(k);function V(t){return new Promise(o=>{setTimeout(o,t)})}function U(){let t,o;return{promise:new Promise((s,u)=>{t=s,o=u}),resolve(s){t&&t(s)},reject(s){o&&o(s)}}}function J(t){setTimeout(()=>t(),1)}function j(t){let o=Math.max(1,t?.concurrency||1),a=t?.onProgress,s=[],u=0,l=!0,c=[],d=0,y=0,g,v=0,p,T=0;return{state(){return l?"idle":D()},enqueue(e){Array.isArray(e)?(s.push(...e),u+=e.length):(s.push(e),u++),y=Date.now()+1e3,x()},promise(e){if(Array.isArray(e))return Promise.all(e.map(r=>this.promise(r)));let i=U();return this.enqueue(()=>e().then(i.resolve,i.reject)),i.promise},forEach(e,i){return Promise.all(e.map((r,n,m)=>this.promise(()=>i(r,n,m)))).then(()=>{})},map(e,i){return Promise.all(e.map((r,n,m)=>this.promise(()=>i(r,n,m))))},reduce(e,i,r){let n=r;return Promise.all(e.map((m,f,P)=>this.promise(()=>i(n,m,f,P).then(h=>{n=h})))).then(()=>n)},some(e,i){let r=!1;return new Promise((n,m)=>{Promise.all(e.map((f,P,h)=>this.promise(()=>r?Promise.resolve():i(f,P,h).then(R=>{R&&(r=!0,n(f))},m)))).then(()=>{r||n(void 0)})})},waitFor(){return new Promise((e,i)=>{setTimeout(r,100);function r(){l?(p?i(p):e(),p=void 0):setTimeout(r,100)}})},setConcurrency(e){o=Math.max(e,1),x()},forceState(e){c=[[e.start,0]],y=e.canRate,u=e.size,T=e.done}};function x(){l&&(c=[[Date.now(),0]],l=!1),s.length?A():d<1?(u=0,T=0,l=!0,b(),setTimeout(()=>{p=void 0},2e3)):b()}function b(){l||Date.now()>v?J(e):(g&&clearTimeout(g),g=setTimeout(b,1e3));function e(){Date.now()<v||a&&(v=Date.now()+1e3,u>0?a(D()):a("idle"))}}function A(){for(;d<o;){let e=s.shift();if(!e)break;d++,b(),e().catch(i=>{p=i}).finally(()=>{T++,d--,b(),x()})}}function D(){return{get size(){return u},get running(){return d},get pending(){return s.length},get done(){return T},get percent(){return Math.round(T/u*1e3)/10},get rate(){return e()||"-"},get timeRemaining(){return i()}};function e(){let r=Date.now();if(r<y)return!1;let n=T+d,m=c[0][1],f=n-m;if(f<=0)return!1;for(c.push([r,n]);c.length>30;)c=c.slice(c.length-30);let P=c[0][0],h=(r-P)/1e3;return f/h}function i(){let r=e();if(r===!1)return"-";let n=(d+s.length)/r;if(n<2)return"one second";if(n<50)return`${n.toFixed(0)} seconds`;if(n<120)return"one minute";let m=n/60;if(m<60)return`${m.toFixed(0)} minutes`;let f=m/60;return m<120?"one hour":`${f.toFixed(0)} hours`}}}0&&(module.exports={asap,defer,queuePromises,sleep});

@@ -5,3 +5,3 @@ {

"description": "A simple, efficient, small and no dependencies queue job executor using promises with concurrency control. And some promise's utilities.",
"version": "2.0.0",
"version": "2.0.1",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc