@inrixia/helpers 3.8.0 → 3.9.0

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.
@@ -1,16 +1,16 @@
1
- export declare class Promize<T> {
2
- p: Promise<T>;
3
- res: (value: T) => void;
1
+ export declare class Promize<T> implements Promise<T> {
2
+ private _promise;
3
+ res: (value: T | PromiseLike<T>) => void;
4
4
  rej: (reason?: any) => void;
5
- /**
6
- * Returns a new instance of a `Promize`, a externally resolvable Promise.
7
- * @param resValue If not undefined, resolves the internal promise with given value on creation.
8
- */
9
5
  constructor(resValue?: T);
10
6
  /**
11
- * Recreate the promise
7
+ * Recreate the underlying promise
12
8
  * @param resValue If not undefined, resolves the internal promise with given value on creation.
13
9
  */
14
10
  set(resValue?: T): void;
11
+ then: Promise<T>["then"];
12
+ catch: Promise<T>["catch"];
13
+ finally: Promise<T>["finally"];
14
+ [Symbol.toStringTag]: string;
15
15
  }
16
16
  //# sourceMappingURL=Promize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Promize.d.ts","sourceRoot":"","sources":["../../src/fn/Promize.ts"],"names":[],"mappings":"AAAA,qBAAa,OAAO,CAAC,CAAC;IACd,CAAC,EAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACtB,GAAG,EAAG,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACzB,GAAG,EAAG,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAE7B;;;OAGG;gBACS,QAAQ,CAAC,EAAE,CAAC;IAIxB;;;OAGG;IACH,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI;CAOvB"}
1
+ {"version":3,"file":"Promize.d.ts","sourceRoot":"","sources":["../../src/fn/Promize.ts"],"names":[],"mappings":"AAAA,qBAAa,OAAO,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;IAC5C,OAAO,CAAC,QAAQ,CAAc;IACvB,GAAG,EAAG,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC1C,GAAG,EAAG,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;gBAExB,QAAQ,CAAC,EAAE,CAAC;IAIxB;;;OAGG;IACH,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI;IAQvB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAsD;IAC9E,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAyC;IACnE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAA+C;IAG7E,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAa;CACzC"}
@@ -1,25 +1,26 @@
1
1
  export class Promize {
2
- p;
2
+ _promise;
3
3
  res;
4
4
  rej;
5
- /**
6
- * Returns a new instance of a `Promize`, a externally resolvable Promise.
7
- * @param resValue If not undefined, resolves the internal promise with given value on creation.
8
- */
9
5
  constructor(resValue) {
10
6
  this.set(resValue);
11
7
  }
12
8
  /**
13
- * Recreate the promise
9
+ * Recreate the underlying promise
14
10
  * @param resValue If not undefined, resolves the internal promise with given value on creation.
15
11
  */
16
12
  set(resValue) {
17
- this.p = new Promise((res, rej) => {
13
+ this._promise = new Promise((res, rej) => {
18
14
  this.res = res;
19
15
  this.rej = rej;
20
16
  });
21
17
  if (resValue !== undefined)
22
18
  this.res(resValue);
23
19
  }
20
+ then = (onRes, onRej) => this._promise.then(onRes, onRej);
21
+ catch = (onRej) => this._promise.catch(onRej);
22
+ finally = (onFinal) => this._promise.finally(onFinal);
23
+ // Required for Promise compatibility
24
+ [Symbol.toStringTag] = "Promise";
24
25
  }
25
26
  //# sourceMappingURL=Promize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Promize.js","sourceRoot":"","sources":["../../src/fn/Promize.ts"],"names":[],"mappings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,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnE,OAAO,GAA0B,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7E,qCAAqC;IACrC,CAAC,MAAM,CAAC,WAAW,CAAC,GAAW,SAAS,CAAC;CACzC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inrixia/helpers",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "Helper functions for various projects",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",