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

mutable-promise

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mutable-promise - npm Package Compare versions

Comparing version 1.1.14 to 1.1.15

6

dist/index.esm.js
const isPromiseLike = (value) => (value && "object" === typeof value && "function" === typeof value.then);
class MutablePromise extends Promise {
// get original `Promise`, avoid other js change the `Promise`
const Promise$1 = (async () => { })().constructor;
class MutablePromise extends Promise$1 {
get status() { return this._s; }

@@ -16,3 +18,3 @@ get isPending() { return "pending" === this._s; }

else if ("function" === typeof value) {
p = new Promise(value);
p = new Promise$1(value);
}

@@ -19,0 +21,0 @@ if (p) {

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

const t=t=>t&&"object"==typeof t&&"function"==typeof t.then;class s extends Promise{get status(){return this._s}get isPending(){return"pending"===this._s}get isFulfilled(){return"fulfilled"===this._s}get isRejected(){return"rejected"===this._s}get task(){return this._task}set task(s){let e;this._task=s,t(s)?e=s:"function"==typeof s&&(e=new Promise(s)),e&&(async()=>{try{const t=await e;s===this._task&&this.resolve(t)}catch(t){s===this._task&&this.reject(t)}})()}get isEmpty(){return null==this._task}constructor(s){let e,i;super(((t,s)=>{e=t,i=s})),this._s="pending",this.resolve=s=>{this.isPending&&(t(s)?this.task=s:(this._s="fulfilled",e(s)))},this.reject=t=>{this.isPending&&(this._s="rejected",i(t))},this.task=s}}export{s as default};
const t=t=>t&&"object"==typeof t&&"function"==typeof t.then,s=(async()=>{})().constructor;class e extends s{get status(){return this._s}get isPending(){return"pending"===this._s}get isFulfilled(){return"fulfilled"===this._s}get isRejected(){return"rejected"===this._s}get task(){return this._task}set task(e){let i;this._task=e,t(e)?i=e:"function"==typeof e&&(i=new s(e)),i&&(async()=>{try{const t=await i;e===this._task&&this.resolve(t)}catch(t){e===this._task&&this.reject(t)}})()}get isEmpty(){return null==this._task}constructor(s){let e,i;super(((t,s)=>{e=t,i=s})),this._s="pending",this.resolve=s=>{this.isPending&&(t(s)?this.task=s:(this._s="fulfilled",e(s)))},this.reject=t=>{this.isPending&&(this._s="rejected",i(t))},this.task=s}}export{e as default};
//# sourceMappingURL=index.min.mjs.map

@@ -8,3 +8,5 @@ (function (global, factory) {

const isPromiseLike = (value) => (value && "object" === typeof value && "function" === typeof value.then);
class MutablePromise extends Promise {
// get original `Promise`, avoid other js change the `Promise`
const Promise$1 = (async () => { })().constructor;
class MutablePromise extends Promise$1 {
get status() { return this._s; }

@@ -23,3 +25,3 @@ get isPending() { return "pending" === this._s; }

else if ("function" === typeof value) {
p = new Promise(value);
p = new Promise$1(value);
}

@@ -26,0 +28,0 @@ if (p) {

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).MutablePromise=e()}(this,(function(){"use strict";const t=t=>t&&"object"==typeof t&&"function"==typeof t.then;return class extends Promise{get status(){return this._s}get isPending(){return"pending"===this._s}get isFulfilled(){return"fulfilled"===this._s}get isRejected(){return"rejected"===this._s}get task(){return this._task}set task(e){let s;this._task=e,t(e)?s=e:"function"==typeof e&&(s=new Promise(e)),s&&(async()=>{try{const t=await s;e===this._task&&this.resolve(t)}catch(t){e===this._task&&this.reject(t)}})()}get isEmpty(){return null==this._task}constructor(e){let s,i;super(((t,e)=>{s=t,i=e})),this._s="pending",this.resolve=e=>{this.isPending&&(t(e)?this.task=e:(this._s="fulfilled",s(e)))},this.reject=t=>{this.isPending&&(this._s="rejected",i(t))},this.task=e}}}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).MutablePromise=e()}(this,(function(){"use strict";const t=t=>t&&"object"==typeof t&&"function"==typeof t.then,e=(async()=>{})().constructor;return class extends e{get status(){return this._s}get isPending(){return"pending"===this._s}get isFulfilled(){return"fulfilled"===this._s}get isRejected(){return"rejected"===this._s}get task(){return this._task}set task(s){let i;this._task=s,t(s)?i=s:"function"==typeof s&&(i=new e(s)),i&&(async()=>{try{const t=await i;s===this._task&&this.resolve(t)}catch(t){s===this._task&&this.reject(t)}})()}get isEmpty(){return null==this._task}constructor(e){let s,i;super(((t,e)=>{s=t,i=e})),this._s="pending",this.resolve=e=>{this.isPending&&(t(e)?this.task=e:(this._s="fulfilled",s(e)))},this.reject=t=>{this.isPending&&(this._s="rejected",i(t))},this.task=e}}}));
//# sourceMappingURL=index.min.js.map

@@ -5,2 +5,3 @@ type ResolveValue<T> = T | PromiseLike<T>;

type Executor<T> = (resolve: Resolve<T>, reject: Reject) => void;
declare const Promise: PromiseConstructor;
declare class MutablePromise<T> extends Promise<T> {

@@ -7,0 +8,0 @@ private _s;

{
"name": "mutable-promise",
"version": "1.1.14",
"version": "1.1.15",
"description": "Wrapper for Promise. Resolvable, rejectable, redirectable.",

@@ -5,0 +5,0 @@ "files": [

@@ -7,3 +7,4 @@ type ResolveValue<T> = T | PromiseLike<T>;

const isPromiseLike = (value:any) => (value && "object" === typeof value && "function" === typeof value.then);
// get original `Promise`, avoid other js change the `Promise`
const Promise = (async()=>{})().constructor as PromiseConstructor;
class MutablePromise<T> extends Promise<T>{

@@ -10,0 +11,0 @@

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

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