pepka 1.9.4 → 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.cjs CHANGED
@@ -86,6 +86,7 @@ const startsWithWith = (comparator) => curry2((start, s) => {
86
86
  const undef = undefined;
87
87
  const nul = null;
88
88
  const inf = Infinity;
89
+ const not_assigned = Symbol();
89
90
  const to = (s) => typeof s;
90
91
  const isNull = (s) => (s === nul);
91
92
  const isUndef = (s) => (s === undef);
@@ -98,28 +99,21 @@ const isNil = (s) => (isNull(s) || isUndef(s));
98
99
  class QPromise extends Promise {
99
100
  oncancel;
100
101
  ff;
101
- rj;
102
102
  _cancel_data;
103
103
  cancel(resolve = false) {
104
104
  if (resolve)
105
105
  this.ff();
106
- else {
107
- super.catch(noop);
108
- this.rj('canceled');
109
- this.oncancel(this._cancel_data);
110
- }
106
+ this.oncancel(this._cancel_data);
111
107
  }
112
108
  constructor(fn, oncancel = noop) {
113
- let _ff, _rj, _cancel_data;
109
+ let _cancel_data = not_assigned;
114
110
  super((ff, rj) => {
115
- _ff = ff;
116
- _rj = rj;
117
111
  _cancel_data = fn(ff, rj);
118
112
  });
119
113
  this.oncancel = oncancel;
120
- const set_cb = () => { this.ff = _ff; this.rj = _rj; this._cancel_data = _cancel_data; };
114
+ const set_cb = () => this._cancel_data = _cancel_data;
121
115
  // @ts-ignore-next
122
- if (!isUndef(_ff) || !isUndef(_rj))
116
+ if (_cancel_data !== not_assigned)
123
117
  set_cb();
124
118
  else
125
119
  setTimeout(set_cb);
package/dist/bundle.d.ts CHANGED
@@ -242,7 +242,6 @@ export declare const isNil: <T extends any>(s: T) => T extends (null | undefined
242
242
  export declare class QPromise<T> extends Promise<T> {
243
243
  private oncancel;
244
244
  private ff;
245
- private rj;
246
245
  private _cancel_data;
247
246
  cancel(resolve?: boolean): void;
248
247
  constructor(fn: AnyFunc<any, [
package/dist/bundle.mjs CHANGED
@@ -84,6 +84,7 @@ const startsWithWith = (comparator) => curry2((start, s) => {
84
84
  const undef = undefined;
85
85
  const nul = null;
86
86
  const inf = Infinity;
87
+ const not_assigned = Symbol();
87
88
  const to = (s) => typeof s;
88
89
  const isNull = (s) => (s === nul);
89
90
  const isUndef = (s) => (s === undef);
@@ -96,28 +97,21 @@ const isNil = (s) => (isNull(s) || isUndef(s));
96
97
  class QPromise extends Promise {
97
98
  oncancel;
98
99
  ff;
99
- rj;
100
100
  _cancel_data;
101
101
  cancel(resolve = false) {
102
102
  if (resolve)
103
103
  this.ff();
104
- else {
105
- super.catch(noop);
106
- this.rj('canceled');
107
- this.oncancel(this._cancel_data);
108
- }
104
+ this.oncancel(this._cancel_data);
109
105
  }
110
106
  constructor(fn, oncancel = noop) {
111
- let _ff, _rj, _cancel_data;
107
+ let _cancel_data = not_assigned;
112
108
  super((ff, rj) => {
113
- _ff = ff;
114
- _rj = rj;
115
109
  _cancel_data = fn(ff, rj);
116
110
  });
117
111
  this.oncancel = oncancel;
118
- const set_cb = () => { this.ff = _ff; this.rj = _rj; this._cancel_data = _cancel_data; };
112
+ const set_cb = () => this._cancel_data = _cancel_data;
119
113
  // @ts-ignore-next
120
- if (!isUndef(_ff) || !isUndef(_rj))
114
+ if (_cancel_data !== not_assigned)
121
115
  set_cb();
122
116
  else
123
117
  setTimeout(set_cb);
package/package.json CHANGED
@@ -41,7 +41,7 @@
41
41
  "prod": "npm run gentypes && npm run prod:es && npm run prod:cjs",
42
42
  "all": "npm run dev && npm run prod"
43
43
  },
44
- "version": "1.9.4",
44
+ "version": "1.9.5",
45
45
  "devDependencies": {
46
46
  "@rollup/plugin-commonjs": "^29.0.2",
47
47
  "@rollup/plugin-node-resolve": "^16.0.3",