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.11.0 to 1.12.0

8

dist-node/index.js

@@ -64,2 +64,6 @@ 'use strict';

Array.prototype.chain_ = function (fn) {
return fn(this);
};
/* eslint-disable @typescript-eslint/no-misused-promises, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-use-before-define */

@@ -795,2 +799,6 @@ /**

Promise.prototype.toTask = function () {
return fromPromise(this);
};
class Subscription {

@@ -797,0 +805,0 @@ constructor() {

@@ -39,1 +39,8 @@ import { all, of } from "../Task/Task";

});
describe("Array.prototype.chain_", () => {
test("should allow Array chaining", () => {
const sum = (arr) => arr.reduce((a, b) => a + b, 0);
const result = [1, 2, 3].chain_(sum);
expect(result).toEqual(6);
});
});

@@ -42,2 +42,11 @@ import { fromPromise } from "../Task";

});
test("should succeed using prototype helper", async () => {
const resolve = jest.fn();
const reject = jest.fn();
const promise = Promise.resolve(SUCCESS_RESULT);
promise.toTask().fork(reject, resolve);
await promise.catch(() => void 0);
expect(resolve).toBeCalledWith(SUCCESS_RESULT);
expect(reject).not.toBeCalled();
});
});

3

dist-src/Task/Task.js

@@ -634,1 +634,4 @@ /* eslint-disable @typescript-eslint/no-misused-promises, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-use-before-define */

}
Promise.prototype.toTask = function () {
return fromPromise(this);
};

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

export const pairsToIndexedObject = (sum, [key, value]) => ((sum[key] = value), sum);
Array.prototype.chain_ = function (fn) {
return fn(this);
};

@@ -349,2 +349,7 @@ export declare type Reject<E> = (error: E) => void;

}
declare global {
interface Promise<T> {
toTask(): Task<unknown, T>;
}
}
//# sourceMappingURL=Task.d.ts.map

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

}>(sum: R, [key, value]: [string, V]) => R;
declare global {
interface Array<T> {
chain_<U>(fn: (arr: Array<T>) => U): U;
}
}
//# sourceMappingURL=util.d.ts.map

@@ -55,2 +55,5 @@ const initialize = () => ({

const pairsToIndexedObject = (sum, [key, value]) => ((sum[key] = value), sum);
Array.prototype.chain_ = function (fn) {
return fn(this);
};

@@ -680,2 +683,5 @@ /* eslint-disable @typescript-eslint/no-misused-promises, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-use-before-define */

}
Promise.prototype.toTask = function () {
return fromPromise(this);
};

@@ -682,0 +688,0 @@ class Subscription {

2

dist-web/index.min.js

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

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

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