@zajno/common 1.3.10 → 1.3.14

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.
Files changed (86) hide show
  1. package/coverage/clover.xml +68 -49
  2. package/coverage/coverage-final.json +3 -2
  3. package/coverage/lcov-report/index.html +26 -26
  4. package/coverage/lcov-report/src/__tests__/helpers/index.html +1 -1
  5. package/coverage/lcov-report/src/__tests__/helpers/main.ts.html +1 -1
  6. package/coverage/lcov-report/src/async/arrays.ts.html +1 -1
  7. package/coverage/lcov-report/src/async/index.html +1 -1
  8. package/coverage/lcov-report/src/dates/calc.ts.html +1 -1
  9. package/coverage/lcov-report/src/dates/convert.ts.html +1 -1
  10. package/coverage/lcov-report/src/dates/datex.ts.html +1 -1
  11. package/coverage/lcov-report/src/dates/format.ts.html +1 -1
  12. package/coverage/lcov-report/src/dates/index.html +1 -1
  13. package/coverage/lcov-report/src/dates/index.ts.html +1 -1
  14. package/coverage/lcov-report/src/dates/parse.ts.html +1 -1
  15. package/coverage/lcov-report/src/dates/period.ts.html +1 -1
  16. package/coverage/lcov-report/src/dates/shift.ts.html +1 -1
  17. package/coverage/lcov-report/src/dates/types.ts.html +1 -1
  18. package/coverage/lcov-report/src/dates/yearDate.ts.html +1 -1
  19. package/coverage/lcov-report/src/enumHelper.ts.html +1 -1
  20. package/coverage/lcov-report/src/event.ts.html +1 -1
  21. package/coverage/lcov-report/src/fields/index.html +15 -15
  22. package/coverage/lcov-report/src/fields/update.ts.html +69 -12
  23. package/coverage/lcov-report/src/functions.ts.html +122 -0
  24. package/coverage/lcov-report/src/index.html +32 -17
  25. package/coverage/lcov-report/src/lazy.light.ts.html +33 -21
  26. package/coverage/lcov-report/src/logger/batch.ts.html +1 -1
  27. package/coverage/lcov-report/src/logger/console.ts.html +1 -1
  28. package/coverage/lcov-report/src/logger/index.html +1 -1
  29. package/coverage/lcov-report/src/logger/index.ts.html +1 -1
  30. package/coverage/lcov-report/src/logger/named.ts.html +1 -1
  31. package/coverage/lcov-report/src/logger/proxy.ts.html +1 -1
  32. package/coverage/lcov-report/src/math/arrays.ts.html +1 -1
  33. package/coverage/lcov-report/src/math/calc.ts.html +1 -1
  34. package/coverage/lcov-report/src/math/distribution.ts.html +1 -1
  35. package/coverage/lcov-report/src/math/index.html +1 -1
  36. package/coverage/lcov-report/src/math/index.ts.html +1 -1
  37. package/coverage/lcov-report/src/transitionObserver.ts.html +1 -1
  38. package/coverage/lcov-report/src/types.ts.html +1 -1
  39. package/coverage/lcov-report/src/validation/ValidationErrors.ts.html +1 -1
  40. package/coverage/lcov-report/src/validation/creditCard.ts.html +1 -1
  41. package/coverage/lcov-report/src/validation/helpers.ts.html +1 -1
  42. package/coverage/lcov-report/src/validation/index.html +1 -1
  43. package/coverage/lcov-report/src/validation/index.ts.html +1 -1
  44. package/coverage/lcov-report/src/validation/types.ts.html +1 -1
  45. package/coverage/lcov-report/src/validation/validators.ts.html +1 -1
  46. package/coverage/lcov-report/src/validation/wrappers.ts.html +1 -1
  47. package/coverage/lcov-report/src/viewModels/FlagModel.ts.html +1 -1
  48. package/coverage/lcov-report/src/viewModels/MultiSelectModel.ts.html +1 -1
  49. package/coverage/lcov-report/src/viewModels/NumberModel.ts.html +1 -1
  50. package/coverage/lcov-report/src/viewModels/SelectModel.ts.html +1 -1
  51. package/coverage/lcov-report/src/viewModels/Validatable.ts.html +1 -1
  52. package/coverage/lcov-report/src/viewModels/index.html +1 -1
  53. package/coverage/lcov-report/src/viewModels/wrappers.ts.html +1 -1
  54. package/coverage/lcov.info +172 -113
  55. package/lib/disposer.d.ts.map +1 -1
  56. package/lib/disposer.js +3 -1
  57. package/lib/disposer.js.map +1 -1
  58. package/lib/fields/update.d.ts +8 -2
  59. package/lib/fields/update.d.ts.map +1 -1
  60. package/lib/fields/update.js +13 -1
  61. package/lib/fields/update.js.map +1 -1
  62. package/lib/functions.d.ts +1 -2
  63. package/lib/functions.d.ts.map +1 -1
  64. package/lib/functions.js.map +1 -1
  65. package/lib/lazy.d.ts +6 -2
  66. package/lib/lazy.d.ts.map +1 -1
  67. package/lib/lazy.js +22 -12
  68. package/lib/lazy.js.map +1 -1
  69. package/lib/lazy.light.d.ts +2 -1
  70. package/lib/lazy.light.d.ts.map +1 -1
  71. package/lib/lazy.light.js +11 -9
  72. package/lib/lazy.light.js.map +1 -1
  73. package/lib/pool.d.ts +12 -4
  74. package/lib/pool.d.ts.map +1 -1
  75. package/lib/pool.js +28 -5
  76. package/lib/pool.js.map +1 -1
  77. package/package.json +5 -3
  78. package/src/disposer.ts +4 -1
  79. package/src/fields/update.ts +22 -3
  80. package/src/functions.ts +1 -3
  81. package/src/lazy.light.ts +15 -11
  82. package/src/lazy.ts +22 -15
  83. package/src/pool.ts +31 -8
  84. package/tsconfig.json +6 -4
  85. package/yarn-error.log +3709 -0
  86. package/yarn.lock +1 -1
package/lib/pool.d.ts CHANGED
@@ -1,7 +1,15 @@
1
+ import type { IDisposable } from './disposer';
1
2
  export declare class Pool<T> {
2
- private _container;
3
- get(factory: () => T): T;
4
- release(e: T): void;
5
- release(e: T[]): void;
3
+ readonly factory: () => T;
4
+ private readonly _container;
5
+ constructor(factory: () => T);
6
+ get(): T;
7
+ release(e: T | T[]): void;
8
+ }
9
+ export declare class PoolDisposable<T extends IDisposable> extends Pool<T> {
10
+ readonly initializer: (item: T) => void;
11
+ constructor(factory: () => T, initializer?: (item: T) => void);
12
+ get(): T;
13
+ release(e: T | T[]): void;
6
14
  }
7
15
  //# sourceMappingURL=pool.d.ts.map
package/lib/pool.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AACA,qBAAa,IAAI,CAAC,CAAC;IAEf,OAAO,CAAC,UAAU,CAAW;IAE7B,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC;IAQxB,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI;IACnB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI;CASxB"}
1
+ {"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,qBAAa,IAAI,CAAC,CAAC;IAIH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAFrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAW;gBAEjB,OAAO,EAAE,MAAM,CAAC;IAE9B,GAAG,IAAI,CAAC;IAQR,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI;CAOnC;AAED,qBAAa,cAAc,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,IAAI,CAAC,CAAC,CAAC;IAEhC,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI;gBAAzD,OAAO,EAAE,MAAM,CAAC,EAAW,WAAW,GAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAW;IAIrE,GAAG,IAAI,CAAC;IAMR,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI;CAQnC"}
package/lib/pool.js CHANGED
@@ -1,26 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Pool = void 0;
3
+ exports.PoolDisposable = exports.Pool = void 0;
4
+ const functions_1 = require("functions");
4
5
  class Pool {
5
- constructor() {
6
+ constructor(factory) {
7
+ this.factory = factory;
6
8
  this._container = [];
7
9
  }
8
- get(factory) {
10
+ get() {
9
11
  if (this._container.length > 0) {
10
12
  return this._container.pop();
11
13
  }
12
14
  else {
13
- return factory();
15
+ return this.factory();
14
16
  }
15
17
  }
16
18
  release(e) {
17
19
  if (Array.isArray(e)) {
18
20
  this._container.push(...e);
19
21
  }
20
- else {
22
+ else if (e) {
21
23
  this._container.push(e);
22
24
  }
23
25
  }
24
26
  }
25
27
  exports.Pool = Pool;
28
+ class PoolDisposable extends Pool {
29
+ constructor(factory, initializer = null) {
30
+ super(factory);
31
+ this.initializer = initializer;
32
+ }
33
+ get() {
34
+ const res = super.get();
35
+ functions_1.safeCall(this.initializer, res);
36
+ return res;
37
+ }
38
+ release(e) {
39
+ if (Array.isArray(e)) {
40
+ e.forEach(ee => ee.dispose());
41
+ }
42
+ else if (e) {
43
+ e.dispose();
44
+ }
45
+ return super.release(e);
46
+ }
47
+ }
48
+ exports.PoolDisposable = PoolDisposable;
26
49
  //# sourceMappingURL=pool.js.map
package/lib/pool.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pool.js","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":";;;AACA,MAAa,IAAI;IAAjB;QAEY,eAAU,GAAQ,EAAE,CAAC;IAoBjC,CAAC;IAlBG,GAAG,CAAC,OAAgB;QAChB,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;SAChC;aAAM;YACH,OAAO,OAAO,EAAE,CAAC;SACpB;IACL,CAAC;IAKD,OAAO,CAAC,CAAU;QACd,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAClB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAC9B;aAAM;YACH,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAC3B;IACL,CAAC;CACJ;AAtBD,oBAsBC"}
1
+ {"version":3,"file":"pool.js","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AAGrC,MAAa,IAAI;IAIb,YAAqB,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;QAFpB,eAAU,GAAQ,EAAE,CAAC;IAEG,CAAC;IAEnC,GAAG;QACN,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;SAChC;aAAM;YACH,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;SACzB;IACL,CAAC;IAEM,OAAO,CAAC,CAAU;QACrB,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAClB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAC9B;aAAM,IAAI,CAAC,EAAE;YACV,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAC3B;IACL,CAAC;CACJ;AArBD,oBAqBC;AAED,MAAa,cAAsC,SAAQ,IAAO;IAE9D,YAAY,OAAgB,EAAW,cAAiC,IAAI;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC;QADoB,gBAAW,GAAX,WAAW,CAA0B;IAE5E,CAAC;IAEM,GAAG;QACN,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;QACxB,oBAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAChC,OAAO,GAAG,CAAC;IACf,CAAC;IAEM,OAAO,CAAC,CAAU;QACrB,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAClB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;SACjC;aAAM,IAAI,CAAC,EAAE;YACV,CAAC,CAAC,OAAO,EAAE,CAAC;SACf;QACD,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;CACJ;AApBD,wCAoBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zajno/common",
3
- "version": "1.3.10",
3
+ "version": "1.3.14",
4
4
  "description": "Zajno's re-usable utilities for JS/TS projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "homepage": "https://github.com/Zajno/common-utils#readme",
15
15
  "scripts": {
16
- "build": "rm -rf ./lib && tsc",
16
+ "build": "rimraf ./lib && tsc",
17
17
  "build:w": "yarn build --watch",
18
18
  "publish:local": "yalc push --replace --update",
19
19
  "prepare": "yarn build && yarn lint && yarn test",
@@ -21,7 +21,9 @@
21
21
  "lint": "eslint \"src/**/*.ts?(x)\"",
22
22
  "test": "yarn jest --clearCache && yarn jest"
23
23
  },
24
- "dependencies": {},
24
+ "dependencies": {
25
+ "rimraf": "^3"
26
+ },
25
27
  "devDependencies": {
26
28
  "@types/faker": "^5.5.9",
27
29
  "@types/jest": "^27.0.2",
package/src/disposer.ts CHANGED
@@ -59,9 +59,12 @@ export class Disposer {
59
59
  );
60
60
  }
61
61
 
62
- this._disposers.forEach(d => d());
62
+ const copy = this._disposers.slice().reverse();
63
63
  this._disposers.length = 0;
64
64
  this._map.clear();
65
+
66
+ // this should separate side effects
67
+ copy.forEach(d => d());
65
68
  }
66
69
  }
67
70
 
@@ -1,3 +1,4 @@
1
+ import { safeCall } from '../functions';
1
2
  import { Comparator } from '../types';
2
3
 
3
4
  export namespace Fields {
@@ -8,7 +9,7 @@ export namespace Fields {
8
9
  }
9
10
 
10
11
 
11
- export function updateField<T>(target: T, source: Partial<T>, diff: Partial<T>, key: keyof T, hasChanged: Fields.Comparer<T> = null): boolean {
12
+ export function updateField<T>(target: T, source: Partial<T>, diff: Partial<T>, key: keyof T, hasChanged: null | Fields.Comparer<T> = null): boolean {
12
13
  return updateFieldExtended(target, source, diff, t => t[key], (t, v) => t[key] = v, hasChanged);
13
14
  }
14
15
 
@@ -18,7 +19,7 @@ export function updateFieldExtended<T>(
18
19
  diff: Partial<T>,
19
20
  get: Fields.Getter<T>,
20
21
  set: Fields.Setter<T>,
21
- hasChanged: Fields.Comparer<T> = null,
22
+ hasChanged: null | Fields.Comparer<T> = null,
22
23
  ): boolean {
23
24
 
24
25
  hasChanged = hasChanged || ((v1: T, v2: T) => (get(v1) !== get(v2)));
@@ -44,6 +45,13 @@ export type UpdateArrayOptions<T> = {
44
45
  comparator?: Comparator<T>,
45
46
  updater?: Fields.Updater<T>,
46
47
  sorter?: Comparator<T, number> | null | undefined,
48
+ hooks?: UpdateArrayHooks<T>,
49
+ };
50
+
51
+ export type UpdateArrayHooks<T> = {
52
+ onAdded?: (item: T) => void,
53
+ onDeleted?: (item: T) => void,
54
+ onUpdated?: (previous: T, next: T) => void,
47
55
  };
48
56
 
49
57
  export function updateArray<T>(
@@ -62,12 +70,18 @@ export function updateArray<T>(
62
70
 
63
71
  const comparator = options?.comparator || DefaultComparator;
64
72
  const updater = options?.updater || DefaultUpdater;
73
+ const onDeleted = options?.hooks?.onDeleted;
74
+ const onUpdate = options?.hooks?.onUpdated;
75
+ const onAdded = options?.hooks?.onAdded;
65
76
 
66
77
  // remove all missing elements
67
78
  if (!options?.additive) {
68
79
  for (let i = 0; i < result.length; ++i) {
69
80
  if (source.find(item => comparator(item, result[i])) == null) {
70
- result.splice(i, 1);
81
+ // DELETE
82
+ const removed = result.splice(i, 1);
83
+ safeCall(onDeleted, removed[0]);
84
+
71
85
  ++changed;
72
86
  --i;
73
87
  }
@@ -80,9 +94,14 @@ export function updateArray<T>(
80
94
  const existingItem = result[existingIndex];
81
95
  if (existingIndex < 0) {
82
96
  result.push(i);
97
+ safeCall(onAdded, i);
83
98
  ++changed;
84
99
  } else if (typeof existingItem === 'object') {
100
+ const before = onUpdate != null ? { ...existingItem } : undefined;
85
101
  result[existingIndex] = updater(existingItem, i);
102
+ if (onUpdate != null) {
103
+ onUpdate(before!, result[existingIndex]);
104
+ }
86
105
  }
87
106
  });
88
107
 
package/src/functions.ts CHANGED
@@ -7,10 +7,8 @@ export type RemoveFunctionFields<T> = {
7
7
  readonly [P in PropertiesOf<T>]: T[P];
8
8
  };
9
9
 
10
- export function safeCall<T extends (...args: any) => any>(cb: T, ...args: Parameters<T>): ReturnType<T> {
10
+ export function safeCall<T extends (...args: any) => any>(cb: T | undefined, ...args: Parameters<T>): ReturnType<T> | void {
11
11
  if (cb) {
12
12
  return cb.apply(null, args);
13
13
  }
14
14
  }
15
-
16
- export type SortingFunction<T> = (i1: T, i2: T) => number;
package/src/lazy.light.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import type { IDisposable } from './disposer';
1
2
 
2
- export type LazyLight<T> = {
3
+ export type LazyLight<T> = IDisposable & {
3
4
  readonly value: T;
4
5
  readonly hasValue: boolean;
5
6
 
@@ -7,19 +8,22 @@ export type LazyLight<T> = {
7
8
  };
8
9
 
9
10
  export function createLazy<T>(factory: () => T) {
10
- return {
11
- _factory: factory,
12
- _instance: undefined as T,
11
+ const _factory = factory;
12
+ let _instance: T = undefined;
13
+
14
+ const res: LazyLight<T> = {
13
15
  get value() {
14
- if (this._instance === undefined) {
15
- this._instance = this._factory();
16
+ if (_instance === undefined) {
17
+ _instance = _factory();
16
18
  }
17
- return this._instance;
19
+ return _instance;
18
20
  },
19
- get hasValue() { return this._instance !== undefined; },
20
- reset() {
21
- this._instance = undefined;
21
+ get hasValue() { return _instance !== undefined; },
22
+ reset: () => {
23
+ _instance = undefined;
22
24
  },
25
+ dispose: () => res.reset(),
26
+ };
23
27
 
24
- } as LazyLight<T>;
28
+ return res;
25
29
  }
package/src/lazy.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { observable, transaction, makeObservable } from 'mobx';
1
+ import type { IDisposable } from 'disposer';
2
+ import { observable, makeObservable, action } from 'mobx';
2
3
 
3
- export default class Lazy<T> {
4
+ export default class Lazy<T> implements IDisposable {
4
5
 
5
6
  @observable.ref
6
7
  private _instance: T = null;
@@ -25,9 +26,11 @@ export default class Lazy<T> {
25
26
  reset() {
26
27
  this._instance = null;
27
28
  }
29
+
30
+ dispose = () => this.reset();
28
31
  }
29
32
 
30
- export class LazyPromise<T> {
33
+ export class LazyPromise<T> implements IDisposable {
31
34
 
32
35
  @observable.ref
33
36
  private _instance: T = null;
@@ -50,23 +53,27 @@ export class LazyPromise<T> {
50
53
  get() {
51
54
  if (!this._loaded && !this._busy) {
52
55
  this._busy = true;
53
- this._factory().then(res => {
54
- transaction(() => {
55
- this._busy = false;
56
- this._loaded = true;
57
- this._instance = res;
58
- });
59
- });
56
+ this._factory().then(this.setInstance);
60
57
  }
61
58
 
62
59
  return this._instance;
63
60
  }
64
61
 
62
+ @action
63
+ private setInstance = (res: T) => {
64
+ const wasBusy = this._busy;
65
+
66
+ this._busy = false;
67
+ this._loaded = wasBusy;
68
+ this._instance = wasBusy ? res : null;
69
+ };
70
+
71
+ @action
65
72
  reset() {
66
- transaction(() => {
67
- this._busy = false;
68
- this._instance = this.initial;
69
- this._loaded = false;
70
- });
73
+ this._busy = false;
74
+ this._instance = this.initial;
75
+ this._loaded = false;
71
76
  }
77
+
78
+ dispose = () => this.reset();
72
79
  }
package/src/pool.ts CHANGED
@@ -1,24 +1,47 @@
1
+ import { safeCall } from 'functions';
2
+ import type { IDisposable } from './disposer';
1
3
 
2
4
  export class Pool<T> {
3
5
 
4
- private _container: T[] = [];
6
+ private readonly _container: T[] = [];
5
7
 
6
- get(factory: () => T): T {
8
+ constructor(readonly factory: () => T) { }
9
+
10
+ public get(): T {
7
11
  if (this._container.length > 0) {
8
12
  return this._container.pop();
9
13
  } else {
10
- return factory();
14
+ return this.factory();
11
15
  }
12
16
  }
13
17
 
14
- release(e: T): void;
15
- release(e: T[]): void;
16
-
17
- release(e: T | T[]) {
18
+ public release(e: T | T[]): void {
18
19
  if (Array.isArray(e)) {
19
20
  this._container.push(...e);
20
- } else {
21
+ } else if (e) {
21
22
  this._container.push(e);
22
23
  }
23
24
  }
24
25
  }
26
+
27
+ export class PoolDisposable<T extends IDisposable> extends Pool<T> {
28
+
29
+ constructor(factory: () => T, readonly initializer: (item: T) => void = null) {
30
+ super(factory);
31
+ }
32
+
33
+ public get(): T {
34
+ const res = super.get();
35
+ safeCall(this.initializer, res);
36
+ return res;
37
+ }
38
+
39
+ public release(e: T | T[]): void {
40
+ if (Array.isArray(e)) {
41
+ e.forEach(ee => ee.dispose());
42
+ } else if (e) {
43
+ e.dispose();
44
+ }
45
+ return super.release(e);
46
+ }
47
+ }
package/tsconfig.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "strict": false,
4
+ "noUnusedLocals": true,
5
+ "strictBindCallApply": true,
3
6
  "outDir": "./lib",
4
- "emitDecoratorMetadata": true,
5
7
  "experimentalDecorators": true,
6
- "strictBindCallApply": true,
8
+ "emitDecoratorMetadata": true,
9
+ "allowSyntheticDefaultImports": true,
7
10
  "skipLibCheck": true,
8
11
  "sourceMap": true,
9
- "allowSyntheticDefaultImports": true,
10
12
  "esModuleInterop": true,
11
13
  "target": "ES2019",
12
14
  "module": "CommonJS",
@@ -18,7 +20,7 @@
18
20
  "importHelpers": true,
19
21
  "baseUrl": "src",
20
22
  "paths": {
21
- }
23
+ },
22
24
  },
23
25
  "include": [
24
26
  "./src"