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

@tdreyno/pretty-please

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tdreyno/pretty-please - npm Package Compare versions

Comparing version 1.16.0 to 1.16.1

69

dist-node/index.js

@@ -76,2 +76,4 @@ 'use strict';

});
const take = (count, arr) => !isFinite(count) ? [...arr] : arr.slice(0, count);
const drop = (count, arr) => !isFinite(count) ? [] : arr.splice(count);

@@ -383,26 +385,3 @@ /* eslint-disable @typescript-eslint/no-misused-promises, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-use-before-define */

const all = tasks => tasks.length === 0 ? of([]) : new Task((reject, resolve) => {
let isDone = false;
let runningTasks = tasks.length;
const results = [];
return tasks.map((task, i) => task.fork(error => {
if (isDone) {
return;
}
isDone = true;
reject(error);
}, result => {
if (isDone) {
return;
}
runningTasks -= 1;
results[i] = result;
if (runningTasks === 0) {
resolve(results);
}
}));
});
const all = tasks => sequence(tasks, Infinity);
/**

@@ -454,3 +433,41 @@ * Given an array of task which return a result, return a new task which returns an array of successful results.

const sequence = tasks => tasks.reduce((sum, task) => chain(list => map(result => [...list, result], task), sum), succeed$1([]));
const sequence = (tasks, maxConcurrent = 1) => new Task((reject, resolve) => {
let isDone = false;
let queue = tasks.map((task, i) => [task, i]);
const inflight = new Set();
const results = [];
const enqueue = () => {
if (isDone) {
return;
}
if (queue.length <= 0 && inflight.size <= 0) {
isDone = true;
resolve(results);
return;
}
const howMany = Math.min(queue.length, maxConcurrent - inflight.size);
const readyTasks = take(howMany, queue);
queue = drop(howMany, queue);
readyTasks.forEach(([task, i]) => {
inflight.add(task);
task.fork(error => {
if (isDone) {
return;
}
isDone = true;
reject(error);
}, result => {
results[i] = result;
inflight.delete(task);
enqueue();
});
});
};
enqueue();
});
/**

@@ -898,2 +915,3 @@ * Given a task, swap the error and success values.

exports.constant = constant;
exports.drop = drop;
exports.failedValidation = failedValidation;

@@ -905,2 +923,3 @@ exports.identity = identity;

exports.successfulValidation = successfulValidation;
exports.take = take;
exports.to = to;

@@ -907,0 +926,0 @@ exports.toIndexedObject = toIndexedObject;

@@ -7,3 +7,3 @@ import { failIn, sequence, succeedIn } from "../Task";

const reject = jest.fn();
sequence([succeedIn(100, "A"), succeedIn(100, "B")]).fork(reject, resolve);
sequence([succeedIn(100, "A"), succeedIn(100, "B")], 1).fork(reject, resolve);
jest.advanceTimersByTime(100);

@@ -10,0 +10,0 @@ expect(reject).not.toBeCalled();

/* eslint-disable @typescript-eslint/no-misused-promises, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-use-before-define */
import { constant, identity, range } from "../util";
import { constant, drop, identity, range, take } from "../util";
/**

@@ -273,25 +273,3 @@ * Creates a Task which can be resolved/rejected externally.

*/
export const all = (tasks) => tasks.length === 0
? of([])
: new Task((reject, resolve) => {
let isDone = false;
let runningTasks = tasks.length;
const results = [];
return tasks.map((task, i) => task.fork((error) => {
if (isDone) {
return;
}
isDone = true;
reject(error);
}, (result) => {
if (isDone) {
return;
}
runningTasks -= 1;
results[i] = result;
if (runningTasks === 0) {
resolve(results);
}
}));
});
export const all = (tasks) => sequence(tasks, Infinity);
/**

@@ -339,3 +317,36 @@ * Given an array of task which return a result, return a new task which returns an array of successful results.

*/
export const sequence = (tasks) => tasks.reduce((sum, task) => chain(list => map(result => [...list, result], task), sum), succeed([]));
export const sequence = (tasks, maxConcurrent = 1) => new Task((reject, resolve) => {
let isDone = false;
let queue = tasks.map((task, i) => [task, i]);
const inflight = new Set();
const results = [];
const enqueue = () => {
if (isDone) {
return;
}
if (queue.length <= 0 && inflight.size <= 0) {
isDone = true;
resolve(results);
return;
}
const howMany = Math.min(queue.length, maxConcurrent - inflight.size);
const readyTasks = take(howMany, queue);
queue = drop(howMany, queue);
readyTasks.forEach(([task, i]) => {
inflight.add(task);
task.fork((error) => {
if (isDone) {
return;
}
isDone = true;
reject(error);
}, (result) => {
results[i] = result;
inflight.delete(task);
enqueue();
});
});
};
enqueue();
});
/**

@@ -342,0 +353,0 @@ * Given a task, swap the error and success values.

@@ -32,1 +32,3 @@ export const range = (end, start = 0) => Array(end - start)

});
export const take = (count, arr) => !isFinite(count) ? [...arr] : arr.slice(0, count);
export const drop = (count, arr) => !isFinite(count) ? [] : arr.splice(count);

@@ -171,3 +171,3 @@ import { Validation } from "../util";

*/
export declare const sequence: <E, S>(tasks: Task<E, S>[]) => Task<E, S[]>;
export declare const sequence: <E, S>(tasks: Task<E, S>[], maxConcurrent?: number) => Task<E, S[]>;
/**

@@ -288,3 +288,3 @@ * Given a task, swap the error and success values.

static allSuccesses: <E_1, S_1>(tasks: Task<E_1, S_1>[]) => Task<never, S_1[]>;
static sequence: <E_1, S_1>(tasks: Task<E_1, S_1>[]) => Task<E_1, S_1[]>;
static sequence: <E_1, S_1>(tasks: Task<E_1, S_1>[], maxConcurrent?: number) => Task<E_1, S_1[]>;
static firstSuccess: <E_1, S_1>(tasks: Task<E_1, S_1>[]) => Task<E_1[], S_1>;

@@ -291,0 +291,0 @@ static never: () => Task<never, never>;

@@ -28,2 +28,4 @@ export declare const range: (end: number, start?: number) => number[];

export declare const failedValidation: <E>(error: E) => Validation<E, never>;
export declare const take: <T>(count: number, arr: T[]) => T[];
export declare const drop: <T>(count: number, arr: T[]) => T[];
//# sourceMappingURL=util.d.ts.map

@@ -66,2 +66,4 @@ const initialize = () => ({

});
const take = (count, arr) => !isFinite(count) ? [...arr] : arr.slice(0, count);
const drop = (count, arr) => !isFinite(count) ? [] : arr.splice(count);

@@ -330,25 +332,3 @@ /* eslint-disable @typescript-eslint/no-misused-promises, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-use-before-define */

*/
const all = (tasks) => tasks.length === 0
? of([])
: new Task((reject, resolve) => {
let isDone = false;
let runningTasks = tasks.length;
const results = [];
return tasks.map((task, i) => task.fork((error) => {
if (isDone) {
return;
}
isDone = true;
reject(error);
}, (result) => {
if (isDone) {
return;
}
runningTasks -= 1;
results[i] = result;
if (runningTasks === 0) {
resolve(results);
}
}));
});
const all = (tasks) => sequence(tasks, Infinity);
/**

@@ -396,3 +376,36 @@ * Given an array of task which return a result, return a new task which returns an array of successful results.

*/
const sequence = (tasks) => tasks.reduce((sum, task) => chain(list => map(result => [...list, result], task), sum), succeed$1([]));
const sequence = (tasks, maxConcurrent = 1) => new Task((reject, resolve) => {
let isDone = false;
let queue = tasks.map((task, i) => [task, i]);
const inflight = new Set();
const results = [];
const enqueue = () => {
if (isDone) {
return;
}
if (queue.length <= 0 && inflight.size <= 0) {
isDone = true;
resolve(results);
return;
}
const howMany = Math.min(queue.length, maxConcurrent - inflight.size);
const readyTasks = take(howMany, queue);
queue = drop(howMany, queue);
readyTasks.forEach(([task, i]) => {
inflight.add(task);
task.fork((error) => {
if (isDone) {
return;
}
isDone = true;
reject(error);
}, (result) => {
results[i] = result;
inflight.delete(task);
enqueue();
});
});
};
enqueue();
});
/**

@@ -761,3 +774,3 @@ * Given a task, swap the error and success values.

export { ExternalTask, LoopBreak, LoopContinue, RemoteData, Subscription, Task, constant, failedValidation, identity, mapToIndexedObject, pairsToIndexedObject, range, successfulValidation, to, toIndexedObject, wrapTaskCreator };
export { ExternalTask, LoopBreak, LoopContinue, RemoteData, Subscription, Task, constant, drop, failedValidation, identity, mapToIndexedObject, pairsToIndexedObject, range, successfulValidation, take, to, toIndexedObject, wrapTaskCreator };
//# sourceMappingURL=index.js.map

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

var t=Object.freeze({__proto__:null,initialize:()=>({type:"Initialized"}),pending:()=>({type:"Pending"}),succeed:t=>({type:"Success",result:t}),fail:t=>({type:"Failure",error:t}),fold:(t,e,r,s,n)=>{switch(n.type){case"Initialized":return t();case"Pending":return e();case"Failure":return r(n.error);case"Success":return s(n.result)}}});const e=(t,e=0)=>Array(t-e).fill(void 0).map(((t,r)=>e+r)),r=t=>(e,r,s,n)=>s===n.length-1?t(n):e,s=t=>()=>t,n=t=>t,i=t=>(e,r,s)=>{const[n,i]=t(r,s);return e[n]=i,e},c=(t,e,r={})=>e.reduce(i(t),r),u=(t,[e,r])=>(t[e]=r,t);Array.prototype.chain_=function(t){return t(this)};const a=t=>({success:!0,value:t}),h=t=>({success:!1,error:t}),o=()=>new _,l=t=>new z(((e,r)=>r(t))),w=l,d=t=>new z(((e,r)=>{try{r(t())}catch(t){e(t)}})),p=t=>new z((e=>e(t))),f=(t,e)=>new z(((r,s)=>e.fork(r,(e=>t(e).fork(r,s))))),m=t=>t instanceof Promise?new z(((e,r)=>t.then(r,e))):w(t),v=t=>d(t).chain(m);class y{constructor(t){this.value=t}}class g{constructor(t){this.value=t}}const b=(t,e)=>new z(((r,s)=>{const n=e=>{t(e).fork((t=>{r(t)}),(t=>{t instanceof y&&s(t.value),t instanceof g&&n(t.value)}))};n(e)})),I=t=>0===t.length?w([]):new z(((e,r)=>{let s=!1,n=t.length;const i=[];return t.map(((t,c)=>t.fork((t=>{s||(s=!0,e(t))}),(t=>{s||(n-=1,i[c]=t,0===n&&r(i))}))))})),k=(t,e)=>new z(((r,s)=>e.fork(r,(e=>s(t(e)))))),E=(t,e,r)=>z.of(t).ap(e).ap(r),P=(t,e)=>new z(((r,s)=>e.fork((e=>r(t(e))),s))),S=(t,e)=>new z(((r,s)=>{let n,i,c=!1,u=!1;const a=t=>e=>{u||(t(e),i&&c&&s(i(n)))},h=t=>{u||(u=!0,r(t))};t.fork(h,a((t=>{i=t}))),e.fork(h,a((t=>{c=!0,n=t})))})),j=t=>t.chain(n);class z{constructor(t){this.computation=t,this.isCanceled=!1}fork(t,e){let r=this.isCanceled;const s={cancel:()=>r=!0};return r||this.computation((e=>{r||t(e)}),(t=>{r||e(t)})),s}cancel(){this.isCanceled=!0}then(t,e){return this.toPromise().then(t,e)}chain(t){return f(t,this)}succeedIf(t){return((t,e)=>new z(((r,s)=>{const n=t();n?s(n):e.fork(r,s)})))(t,this)}onlyOnce(){return(t=>{let e,r,s="initialized",n=0;const i={},c=(t,e)=>{const r=n++;i[r]={reject:t,resolve:e}},u=t=>{s="failure",r=t,Object.keys(i).forEach((e=>{i[e].reject(t),delete i[e]}))},a=t=>{s="success",e=t,Object.keys(i).forEach((e=>{i[e].resolve(t),delete i[e]}))};return new z(((n,i)=>{switch(s){case"success":i(e);break;case"failure":n(r);break;case"pending":c(n,i);break;case"initialized":s="pending",c(n,i),t.fork(u,a)}}))})(this)}toPromise(){return t=this,new Promise(((e,r)=>t.fork(r,e)));var t}swap(){return t=this,new z(((e,r)=>t.fork((t=>r(t)),(t=>e(t)))));var t}map(t){return k(t,this)}forward(t){return k(s(t),this)}append(...t){return k((e=>[e,...t]),this)}prepend(...t){return k((e=>[...t,e]),this)}tap(t){return((t,e)=>k((e=>(t(e),e)),this))(t)}tapChain(t){return((t,e)=>f((e=>t(e).forward(e)),this))(t)}validate(t){return((t,e)=>f((e=>{const r=t(e);return r.success?w(r.value):p(r.error)}),this))(t)}mapError(t){return P(t,this)}validateError(t){return((t,e)=>P((e=>{if(!t(e))throw new Error("validateError failed");return e}),this))(t)}errorUnion(){return this}mapBoth(t,e){return((t,e,r)=>P(t,k(e,this)))(t,e)}fold(t,e){return((t,e,r)=>new z(((s,n)=>r.fork((e=>n(t(e))),(t=>n(e(t)))))))(t,e,this)}orElse(t){return((t,e)=>new z(((r,s)=>e.fork((e=>t(e).fork(r,s)),s))))(t,this)}ap(t){return S(this,t)}wait(t){return((t,e)=>new z(((r,s)=>{setTimeout((()=>e.fork(r,s)),t)})))(t,this)}retryIn(t){return((t,e)=>e.orElse((()=>e.wait(t))))(t,this)}retryWithExponentialBackoff(t,r){return((t,r,s)=>e(r).reduce(((e,r)=>e.retryIn(t*2**r)),s))(t,r,this)}flatten(){return j(this)}failIf(t,e){return((t,e,r)=>this.chain((r=>t(r)?p(e(r)):w(r))))(t,e)}}z.fail=p,z.succeed=l,z.empty=()=>w(void 0),z.failIn=(t,e)=>new z((r=>setTimeout((()=>r(e)),t))),z.succeedIn=(t,e)=>new z(((r,s)=>setTimeout((()=>s(e)),t))),z.of=l,z.all=I,z.allSuccesses=t=>0===t.length?w([]):new z(((e,r)=>{let s=t.length;const n=[];return t.map((t=>t.fork((()=>{s-=1,0===s&&r(n)}),(t=>{s-=1,n.push(t),0===s&&r(n)}))))})),z.sequence=t=>t.reduce(((t,e)=>f((t=>k((e=>[...t,e]),e)),t)),l([])),z.firstSuccess=t=>0===t.length?p([]):new z(((e,r)=>{let s=!1,n=t.length;const i=[];return t.map((t=>t.fork((t=>{s||(n-=1,i.push(t),0===n&&e(i))}),(t=>{s||(s=!0,r(t))}))))})),z.never=()=>new z((()=>{})),z.fromPromise=m,z.fromPromises=t=>I(t.map(m)),z.fromLazyPromise=v,z.wrapPromiseCreator=t=>(...e)=>v((()=>t(...e))),z.race=t=>new z(((e,r)=>{let s=!1;return t.map((t=>t.fork((t=>{s||(s=!0,e(t))}),(t=>{s||(s=!0,r(t))}))))})),z.external=o,z.emitter=t=>{const e=o();return[e,(...r)=>{try{e.resolve(t(...r))}catch(t){e.reject(t)}}]},z.succeedBy=d,z.ap=S,z.map2=E,z.map3=(t,e,r,s)=>z.of(t).ap(e).ap(r).ap(s),z.map4=(t,e,r,s,n)=>z.of(t).ap(e).ap(r).ap(s).ap(n),z.loop=b,z.reduce=(t,e,r)=>b((({remainingItems:e,currentResult:s})=>{if(0===e.length)return w(new y(s));const[n,...i]=e,c=r.length-i.length-1;return t(s,n,c,r).map((t=>new g({remainingItems:i,currentResult:t})))}),{remainingItems:r,currentResult:e}),z.zip=(t,e)=>E((t=>e=>[t,e]),t,e),z.zipWith=(t,e,r)=>E((e=>r=>t(e,r)),e,r),z.flatten=j;class _ extends z{constructor(){super(((t,e)=>{switch(this.t){case"error":t(this.i);case"success":e(this.u);case"pending":this.h=t,this.o=e}})),this.t="pending"}reject(t){this.i=t,this.t="error",this.h&&this.h(t)}resolve(t){this.u=t,this.t="success",this.o&&this.o(t)}}Promise.prototype.toTask=function(){return m(this)};class A{constructor(){this.l=new Set,this.p="inactive",this.m=new Set}emit(t){return z.all(Array.from(this.l).map((e=>e(t)||z.empty())))}subscribe(t){return this.l.add(t),this.v(),()=>{this.l.delete(t),this.v()}}clear(){this.l.clear(),this.v()}onStatusChange(t){return this.m.add(t),()=>this.m.delete(t)}v(){const t=this.l.size>0?"active":"inactive";t!==this.p&&(this.p=t,Array.from(this.m).map((e=>e(t))))}}const O=t=>(...e)=>t(...e).toPromise();export{_ as ExternalTask,y as LoopBreak,g as LoopContinue,t as RemoteData,A as Subscription,z as Task,s as constant,h as failedValidation,n as identity,c as mapToIndexedObject,u as pairsToIndexedObject,e as range,a as successfulValidation,r as to,i as toIndexedObject,O as wrapTaskCreator};
var t=Object.freeze({__proto__:null,initialize:()=>({type:"Initialized"}),pending:()=>({type:"Pending"}),succeed:t=>({type:"Success",result:t}),fail:t=>({type:"Failure",error:t}),fold:(t,e,r,s,n)=>{switch(n.type){case"Initialized":return t();case"Pending":return e();case"Failure":return r(n.error);case"Success":return s(n.result)}}});const e=(t,e=0)=>Array(t-e).fill(void 0).map(((t,r)=>e+r)),r=t=>(e,r,s,n)=>s===n.length-1?t(n):e,s=t=>()=>t,n=t=>t,i=t=>(e,r,s)=>{const[n,i]=t(r,s);return e[n]=i,e},c=(t,e,r={})=>e.reduce(i(t),r),u=(t,[e,r])=>(t[e]=r,t);Array.prototype.chain_=function(t){return t(this)};const a=t=>({success:!0,value:t}),h=t=>({success:!1,error:t}),o=(t,e)=>isFinite(t)?e.slice(0,t):[...e],l=(t,e)=>isFinite(t)?e.splice(t):[],w=()=>new O,d=t=>new F(((e,r)=>r(t))),p=d,f=t=>new F(((e,r)=>{try{r(t())}catch(t){e(t)}})),m=t=>new F((e=>e(t))),v=(t,e)=>new F(((r,s)=>e.fork(r,(e=>t(e).fork(r,s))))),y=t=>t instanceof Promise?new F(((e,r)=>t.then(r,e))):p(t),g=t=>f(t).chain(y);class b{constructor(t){this.value=t}}class I{constructor(t){this.value=t}}const S=(t,e)=>new F(((r,s)=>{const n=e=>{t(e).fork((t=>{r(t)}),(t=>{t instanceof b&&s(t.value),t instanceof I&&n(t.value)}))};n(e)})),k=t=>E(t,1/0),E=(t,e=1)=>new F(((r,s)=>{let n=!1,i=t.map(((t,e)=>[t,e]));const c=new Set,u=[],a=()=>{if(n)return;if(i.length<=0&&c.size<=0)return n=!0,void s(u);const t=Math.min(i.length,e-c.size),h=o(t,i);i=l(t,i),h.forEach((([t,e])=>{c.add(t),t.fork((t=>{n||(n=!0,r(t))}),(r=>{u[e]=r,c.delete(t),a()}))}))};a()})),P=(t,e)=>new F(((r,s)=>e.fork(r,(e=>s(t(e)))))),j=(t,e,r)=>F.of(t).ap(e).ap(r),z=(t,e)=>new F(((r,s)=>e.fork((e=>r(t(e))),s))),_=(t,e)=>new F(((r,s)=>{let n,i,c=!1,u=!1;const a=t=>e=>{u||(t(e),i&&c&&s(i(n)))},h=t=>{u||(u=!0,r(t))};t.fork(h,a((t=>{i=t}))),e.fork(h,a((t=>{c=!0,n=t})))})),A=t=>t.chain(n);class F{constructor(t){this.computation=t,this.isCanceled=!1}fork(t,e){let r=this.isCanceled;const s={cancel:()=>r=!0};return r||this.computation((e=>{r||t(e)}),(t=>{r||e(t)})),s}cancel(){this.isCanceled=!0}then(t,e){return this.toPromise().then(t,e)}chain(t){return v(t,this)}succeedIf(t){return((t,e)=>new F(((r,s)=>{const n=t();n?s(n):e.fork(r,s)})))(t,this)}onlyOnce(){return(t=>{let e,r,s="initialized",n=0;const i={},c=(t,e)=>{const r=n++;i[r]={reject:t,resolve:e}},u=t=>{s="failure",r=t,Object.keys(i).forEach((e=>{i[e].reject(t),delete i[e]}))},a=t=>{s="success",e=t,Object.keys(i).forEach((e=>{i[e].resolve(t),delete i[e]}))};return new F(((n,i)=>{switch(s){case"success":i(e);break;case"failure":n(r);break;case"pending":c(n,i);break;case"initialized":s="pending",c(n,i),t.fork(u,a)}}))})(this)}toPromise(){return t=this,new Promise(((e,r)=>t.fork(r,e)));var t}swap(){return t=this,new F(((e,r)=>t.fork((t=>r(t)),(t=>e(t)))));var t}map(t){return P(t,this)}forward(t){return P(s(t),this)}append(...t){return P((e=>[e,...t]),this)}prepend(...t){return P((e=>[...t,e]),this)}tap(t){return((t,e)=>P((e=>(t(e),e)),this))(t)}tapChain(t){return((t,e)=>v((e=>t(e).forward(e)),this))(t)}validate(t){return((t,e)=>v((e=>{const r=t(e);return r.success?p(r.value):m(r.error)}),this))(t)}mapError(t){return z(t,this)}validateError(t){return((t,e)=>z((e=>{if(!t(e))throw new Error("validateError failed");return e}),this))(t)}errorUnion(){return this}mapBoth(t,e){return((t,e,r)=>z(t,P(e,this)))(t,e)}fold(t,e){return((t,e,r)=>new F(((s,n)=>r.fork((e=>n(t(e))),(t=>n(e(t)))))))(t,e,this)}orElse(t){return((t,e)=>new F(((r,s)=>e.fork((e=>t(e).fork(r,s)),s))))(t,this)}ap(t){return _(this,t)}wait(t){return((t,e)=>new F(((r,s)=>{setTimeout((()=>e.fork(r,s)),t)})))(t,this)}retryIn(t){return((t,e)=>e.orElse((()=>e.wait(t))))(t,this)}retryWithExponentialBackoff(t,r){return((t,r,s)=>e(r).reduce(((e,r)=>e.retryIn(t*2**r)),s))(t,r,this)}flatten(){return A(this)}failIf(t,e){return((t,e,r)=>this.chain((r=>t(r)?m(e(r)):p(r))))(t,e)}}F.fail=m,F.succeed=d,F.empty=()=>p(void 0),F.failIn=(t,e)=>new F((r=>setTimeout((()=>r(e)),t))),F.succeedIn=(t,e)=>new F(((r,s)=>setTimeout((()=>s(e)),t))),F.of=d,F.all=k,F.allSuccesses=t=>0===t.length?p([]):new F(((e,r)=>{let s=t.length;const n=[];return t.map((t=>t.fork((()=>{s-=1,0===s&&r(n)}),(t=>{s-=1,n.push(t),0===s&&r(n)}))))})),F.sequence=E,F.firstSuccess=t=>0===t.length?m([]):new F(((e,r)=>{let s=!1,n=t.length;const i=[];return t.map((t=>t.fork((t=>{s||(n-=1,i.push(t),0===n&&e(i))}),(t=>{s||(s=!0,r(t))}))))})),F.never=()=>new F((()=>{})),F.fromPromise=y,F.fromPromises=t=>k(t.map(y)),F.fromLazyPromise=g,F.wrapPromiseCreator=t=>(...e)=>g((()=>t(...e))),F.race=t=>new F(((e,r)=>{let s=!1;return t.map((t=>t.fork((t=>{s||(s=!0,e(t))}),(t=>{s||(s=!0,r(t))}))))})),F.external=w,F.emitter=t=>{const e=w();return[e,(...r)=>{try{e.resolve(t(...r))}catch(t){e.reject(t)}}]},F.succeedBy=f,F.ap=_,F.map2=j,F.map3=(t,e,r,s)=>F.of(t).ap(e).ap(r).ap(s),F.map4=(t,e,r,s,n)=>F.of(t).ap(e).ap(r).ap(s).ap(n),F.loop=S,F.reduce=(t,e,r)=>S((({remainingItems:e,currentResult:s})=>{if(0===e.length)return p(new b(s));const[n,...i]=e,c=r.length-i.length-1;return t(s,n,c,r).map((t=>new I({remainingItems:i,currentResult:t})))}),{remainingItems:r,currentResult:e}),F.zip=(t,e)=>j((t=>e=>[t,e]),t,e),F.zipWith=(t,e,r)=>j((e=>r=>t(e,r)),e,r),F.flatten=A;class O extends F{constructor(){super(((t,e)=>{switch(this.t){case"error":t(this.i);case"success":e(this.u);case"pending":this.h=t,this.o=e}})),this.t="pending"}reject(t){this.i=t,this.t="error",this.h&&this.h(t)}resolve(t){this.u=t,this.t="success",this.o&&this.o(t)}}Promise.prototype.toTask=function(){return y(this)};class x{constructor(){this.l=new Set,this.p="inactive",this.m=new Set}emit(t){return F.all(Array.from(this.l).map((e=>e(t)||F.empty())))}subscribe(t){return this.l.add(t),this.v(),()=>{this.l.delete(t),this.v()}}clear(){this.l.clear(),this.v()}onStatusChange(t){return this.m.add(t),()=>this.m.delete(t)}v(){const t=this.l.size>0?"active":"inactive";t!==this.p&&(this.p=t,Array.from(this.m).map((e=>e(t))))}}const R=t=>(...e)=>t(...e).toPromise();export{O as ExternalTask,b as LoopBreak,I as LoopContinue,t as RemoteData,x as Subscription,F as Task,s as constant,l as drop,h as failedValidation,n as identity,c as mapToIndexedObject,u as pairsToIndexedObject,e as range,a as successfulValidation,o as take,r as to,i as toIndexedObject,R as wrapTaskCreator};
{
"name": "@tdreyno/pretty-please",
"version": "1.16.0",
"version": "1.16.1",
"files": [

@@ -16,5 +16,5 @@ "dist-*/",

"devDependencies": {
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"@commitlint/prompt": "^12.1.4",
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.2.0",
"@commitlint/prompt": "^13.2.0",
"@pika/pack": "^0.5.0",

@@ -24,27 +24,27 @@ "@pika/plugin-build-node": "^0.9.2",

"@pika/plugin-ts-standard-pkg": "^0.9.2",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@semantic-release/github": "^7.2.3",
"@types/jest": "^26.0.23",
"@types/react": "^17.0.8",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"@semantic-release/changelog": "^6.0.0",
"@semantic-release/git": "^10.0.0",
"@semantic-release/github": "^8.0.1",
"@types/jest": "^27.0.2",
"@types/react": "^17.0.26",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.30.0",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "3.3.0",
"eslint": "^7.27.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-prettier": "^4.0.0",
"gzip-size-cli": "^5.0.0",
"husky": "^6.0.0",
"jest": "^27.0.0",
"lint-staged": "^11.0.0",
"prettier": "^2.3.0",
"semantic-release": "^17.4.3",
"terser": "^5.7.0",
"ts-jest": "^27.0.0",
"husky": "^7.0.1",
"jest": "^27.0.6",
"lint-staged": "^11.1.2",
"prettier": "^2.3.2",
"semantic-release": "^18.0.0",
"terser": "^5.9.0",
"ts-jest": "^27.0.5",
"ts-toolbelt": "^9.6.0",
"typescript": "^4.3.2"
"typescript": "^4.3.5"
},
"engines": {
"node": ">=10"
"node": ">=14"
},

@@ -51,0 +51,0 @@ "publishConfig": {

@@ -6,3 +6,3 @@ # Pretty Please

Pretty Please is a TypeScript library that provides Tasks as an alternative to [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). Tasks are a very common solution to asynchronicity (see Prior Art below) and can be used in place of Promises. They differ from Promises in several ways.
Pretty Please is a TypeScript library that provides Tasks as an alternative to [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). Tasks are a common solution to asynchronicity (see Prior Art below) and can be used in place of Promises. They differ from Promises in several ways.

@@ -9,0 +9,0 @@ ## Lazy Execution

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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