@zajno/common 1.3.7 → 1.3.11
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/coverage/clover.xml +221 -202
- package/coverage/coverage-final.json +9 -8
- package/coverage/lcov-report/index.html +38 -38
- package/coverage/lcov-report/src/__tests__/helpers/index.html +1 -1
- package/coverage/lcov-report/src/__tests__/helpers/main.ts.html +1 -1
- package/coverage/lcov-report/src/async/arrays.ts.html +1 -1
- package/coverage/lcov-report/src/async/index.html +1 -1
- package/coverage/lcov-report/src/dates/calc.ts.html +2 -2
- package/coverage/lcov-report/src/dates/convert.ts.html +7 -40
- package/coverage/lcov-report/src/dates/datex.ts.html +1 -1
- package/coverage/lcov-report/src/dates/format.ts.html +8 -5
- package/coverage/lcov-report/src/dates/index.html +13 -13
- package/coverage/lcov-report/src/dates/index.ts.html +1 -1
- package/coverage/lcov-report/src/dates/parse.ts.html +42 -6
- package/coverage/lcov-report/src/dates/period.ts.html +1 -1
- package/coverage/lcov-report/src/dates/shift.ts.html +2 -2
- package/coverage/lcov-report/src/dates/types.ts.html +1 -1
- package/coverage/lcov-report/src/dates/yearDate.ts.html +2 -2
- package/coverage/lcov-report/src/enumHelper.ts.html +1 -1
- package/coverage/lcov-report/src/event.ts.html +1 -1
- package/coverage/lcov-report/src/fields/index.html +15 -15
- package/coverage/lcov-report/src/fields/update.ts.html +69 -12
- package/coverage/lcov-report/src/functions.ts.html +122 -0
- package/coverage/lcov-report/src/index.html +24 -9
- package/coverage/lcov-report/src/lazy.light.ts.html +1 -1
- package/coverage/lcov-report/src/logger/batch.ts.html +1 -1
- package/coverage/lcov-report/src/logger/console.ts.html +1 -1
- package/coverage/lcov-report/src/logger/index.html +1 -1
- package/coverage/lcov-report/src/logger/index.ts.html +1 -1
- package/coverage/lcov-report/src/logger/named.ts.html +1 -1
- package/coverage/lcov-report/src/logger/proxy.ts.html +1 -1
- package/coverage/lcov-report/src/math/arrays.ts.html +1 -1
- package/coverage/lcov-report/src/math/calc.ts.html +19 -10
- package/coverage/lcov-report/src/math/distribution.ts.html +1 -1
- package/coverage/lcov-report/src/math/index.html +19 -19
- package/coverage/lcov-report/src/math/index.ts.html +1 -1
- package/coverage/lcov-report/src/transitionObserver.ts.html +2 -2
- package/coverage/lcov-report/src/types.ts.html +14 -2
- package/coverage/lcov-report/src/validation/ValidationErrors.ts.html +1 -1
- package/coverage/lcov-report/src/validation/creditCard.ts.html +1 -1
- package/coverage/lcov-report/src/validation/helpers.ts.html +1 -1
- package/coverage/lcov-report/src/validation/index.html +1 -1
- package/coverage/lcov-report/src/validation/index.ts.html +1 -1
- package/coverage/lcov-report/src/validation/types.ts.html +1 -1
- package/coverage/lcov-report/src/validation/validators.ts.html +1 -1
- package/coverage/lcov-report/src/validation/wrappers.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/FlagModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/MultiSelectModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/NumberModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/SelectModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/Validatable.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/index.html +1 -1
- package/coverage/lcov-report/src/viewModels/wrappers.ts.html +1 -1
- package/coverage/lcov.info +475 -415
- package/lib/dates/calc.js +3 -3
- package/lib/dates/calc.js.map +1 -1
- package/lib/dates/convert.d.ts +0 -2
- package/lib/dates/convert.d.ts.map +1 -1
- package/lib/dates/convert.js +10 -20
- package/lib/dates/convert.js.map +1 -1
- package/lib/dates/format.d.ts.map +1 -1
- package/lib/dates/format.js +4 -3
- package/lib/dates/format.js.map +1 -1
- package/lib/dates/parse.d.ts +2 -0
- package/lib/dates/parse.d.ts.map +1 -1
- package/lib/dates/parse.js +12 -1
- package/lib/dates/parse.js.map +1 -1
- package/lib/dates/shift.js +6 -6
- package/lib/dates/shift.js.map +1 -1
- package/lib/dates/yearDate.js +3 -3
- package/lib/dates/yearDate.js.map +1 -1
- package/lib/disposer.d.ts +22 -0
- package/lib/disposer.d.ts.map +1 -0
- package/lib/disposer.js +65 -0
- package/lib/disposer.js.map +1 -0
- package/lib/fields/update.d.ts +8 -2
- package/lib/fields/update.d.ts.map +1 -1
- package/lib/fields/update.js +13 -1
- package/lib/fields/update.js.map +1 -1
- package/lib/functions.d.ts +1 -2
- package/lib/functions.d.ts.map +1 -1
- package/lib/functions.js.map +1 -1
- package/lib/math/calc.d.ts +1 -0
- package/lib/math/calc.d.ts.map +1 -1
- package/lib/math/calc.js +5 -1
- package/lib/math/calc.js.map +1 -1
- package/lib/transitionObserver.d.ts +1 -1
- package/lib/transitionObserver.d.ts.map +1 -1
- package/lib/types.d.ts +3 -0
- package/lib/types.d.ts.map +1 -1
- package/lib/unsubscriber.d.ts +1 -20
- package/lib/unsubscriber.d.ts.map +1 -1
- package/lib/unsubscriber.js +6 -56
- package/lib/unsubscriber.js.map +1 -1
- package/package.json +1 -1
- package/src/dates/calc.ts +1 -1
- package/src/dates/convert.ts +1 -12
- package/src/dates/format.ts +2 -1
- package/src/dates/parse.ts +12 -0
- package/src/dates/shift.ts +1 -1
- package/src/dates/yearDate.ts +1 -1
- package/src/disposer.ts +81 -0
- package/src/fields/update.ts +22 -3
- package/src/functions.ts +1 -3
- package/src/math/calc.ts +3 -0
- package/src/transitionObserver.ts +1 -1
- package/src/types.ts +4 -0
- package/src/unsubscriber.ts +9 -75
- package/tsconfig.json +6 -4
package/lib/math/calc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.random = exports.roundHalf = exports.roundNumber = exports.getIntersection = exports.contains = exports.clamp01 = exports.clamp = void 0;
|
|
3
|
+
exports.badRandomString = exports.random = exports.roundHalf = exports.roundNumber = exports.getIntersection = exports.contains = exports.clamp01 = exports.clamp = void 0;
|
|
4
4
|
function clamp(val, min = undefined, max = undefined, cycle = false) {
|
|
5
5
|
if (min != null && val < min) {
|
|
6
6
|
return (max != null && cycle) ? max : min;
|
|
@@ -67,4 +67,8 @@ function random(min = 0, max = 1, trunc = true) {
|
|
|
67
67
|
return trunc ? Math.trunc(res) : res;
|
|
68
68
|
}
|
|
69
69
|
exports.random = random;
|
|
70
|
+
function badRandomString(length = 12) {
|
|
71
|
+
return Math.random().toString(26).slice(2, clamp(length, 0, 12));
|
|
72
|
+
}
|
|
73
|
+
exports.badRandomString = badRandomString;
|
|
70
74
|
//# sourceMappingURL=calc.js.map
|
package/lib/math/calc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calc.js","sourceRoot":"","sources":["../../src/math/calc.ts"],"names":[],"mappings":";;;AACA,SAAgB,KAAK,CAAC,GAAW,EAAE,MAAc,SAAS,EAAE,MAAc,SAAS,EAAE,KAAK,GAAG,KAAK;IAC9F,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;QAC1B,OAAO,CAAC,GAAG,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;KAC7C;IAED,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE;QAC1B,OAAO,CAAC,GAAG,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;KAC7C;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAVD,sBAUC;AAED,SAAgB,OAAO,CAAC,GAAW;IAC/B,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAFD,0BAEC;AAED,SAAgB,QAAQ,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU;IAC1D,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC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AAM;QACrC;YAAS,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAC,MAAM;KACrC;IACD,OAAO,CAAC,GAAG,CAAC,CAAC;AACjB,CAAC;AATD,kCASC;AAED,SAAgB,SAAS,CAAC,GAAW;IACjC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAFD,8BAEC;AAED,SAAgB,MAAM,CAAC,MAAc,CAAC,EAAE,MAAc,CAAC,EAAE,KAAK,GAAG,IAAI;IACjE,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IACxB,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACzC,CAAC;AAJD,wBAIC;AAED,SAAgB,eAAe,CAAC,MAAM,GAAG,EAAE;IACvC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACrE,CAAC;AAFD,0CAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transitionObserver.d.ts","sourceRoot":"","sources":["../src/transitionObserver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAS,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"transitionObserver.d.ts","sourceRoot":"","sources":["../src/transitionObserver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAS,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,qBAAa,kBAAkB,CAAC,CAAC,CAAE,YAAW,WAAW;IAErD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,OAAO,CAAiB;IAEhC,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,KAAK,CAAgB;IAE7B,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,GAAG,CAAgB;IAE3B,OAAO,CAAC,GAAG,CAAgB;IAC3B,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,cAAc,CAA4B;IAElD,OAAO,CAAC,MAAM,CAAoC;gBAEtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAM5B,IAAW,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,CAAwB;IACrD,IAAW,YAAY,MAAyB;IAEhD,IAAW,WAAW,YAAqC;IAC3D,OAAO,KAAK,WAAW,GAA0C;IAEjE,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC;IAQvB,IAAI,CAAC,IAAI,EAAE,CAAC;IAKZ,EAAE,CAAC,EAAE,EAAE,CAAC;IAKR,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG;IAQpB,SAAS;IAOT,QAAQ,CAAC,MAAM,UAAO;IAKtB,UAAU;IAIV,aAAa;IAKb,UAAU,CAAC,OAAO,GAAE,MAAa;IA2BjC,OAAO;IAMP,aAAa,CAAC,IAAI,EAAE,MAAM;IAK1B,OAAO,aASL;IAEF,OAAO,CAAC,WAAW,CAiCjB;IAEF,OAAO,CAAC,cAAc;CAQzB"}
|
package/lib/types.d.ts
CHANGED
|
@@ -11,4 +11,7 @@ export declare type Comparator<T, C = boolean> = (v1: T, v2: T) => C;
|
|
|
11
11
|
export declare namespace Comparator {
|
|
12
12
|
const Default: Comparator<any>;
|
|
13
13
|
}
|
|
14
|
+
export declare type TypedKeys<T extends Object, K> = {
|
|
15
|
+
[P in keyof T]: T[P] extends K ? P : never;
|
|
16
|
+
}[keyof T];
|
|
14
17
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,oBAAY,YAAY,CAAC,CAAC,IAAI;IAC1B,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9C,CAAC;AAEF,oBAAY,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAE7C,yBAAiB,MAAM,CAAC;IACpB,SAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAQhD;CACJ;AAED,oBAAY,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;AACjD,oBAAY,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAE7D,yBAAiB,UAAU,CAAC;IACjB,MAAM,OAAO,EAAE,UAAU,CAAC,GAAG,CAAqB,CAAC;CAC7D"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,oBAAY,YAAY,CAAC,CAAC,IAAI;IAC1B,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9C,CAAC;AAEF,oBAAY,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAE7C,yBAAiB,MAAM,CAAC;IACpB,SAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAQhD;CACJ;AAED,oBAAY,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;AACjD,oBAAY,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAE7D,yBAAiB,UAAU,CAAC;IACjB,MAAM,OAAO,EAAE,UAAU,CAAC,GAAG,CAAqB,CAAC;CAC7D;AAED,oBAAY,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,IAAI;KACxC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK;CAC7C,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
package/lib/unsubscriber.d.ts
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
dispose(): void;
|
|
3
|
-
}
|
|
4
|
-
export interface Disposer {
|
|
5
|
-
(): void;
|
|
6
|
-
}
|
|
7
|
-
export declare class Unsubscriber {
|
|
8
|
-
readonly logName: string;
|
|
9
|
-
private readonly _disposers;
|
|
10
|
-
private readonly _map;
|
|
11
|
-
constructor(logName?: string);
|
|
12
|
-
add(d: Disposer | IDisposable, id?: string): void;
|
|
13
|
-
execute(id: string): void;
|
|
14
|
-
dispose(log?: boolean): void;
|
|
15
|
-
}
|
|
16
|
-
export declare function combineDisposers(...items: Disposer[]): Disposer;
|
|
17
|
-
export declare class Disposable implements IDisposable {
|
|
18
|
-
protected readonly disposer: Unsubscriber;
|
|
19
|
-
dispose: () => void;
|
|
20
|
-
}
|
|
1
|
+
export { IDisposable, DisposeFunction as Disposer, combineDisposers, Disposer as Unsubscriber, Disposable, } from './disposer';
|
|
21
2
|
//# sourceMappingURL=unsubscriber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsubscriber.d.ts","sourceRoot":"","sources":["../src/unsubscriber.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"unsubscriber.d.ts","sourceRoot":"","sources":["../src/unsubscriber.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,WAAW,EACX,eAAe,IAAI,QAAQ,EAC3B,gBAAgB,EAChB,QAAQ,IAAI,YAAY,EACxB,UAAU,GACb,MAAM,YAAY,CAAC"}
|
package/lib/unsubscriber.js
CHANGED
|
@@ -1,61 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Disposable = exports.
|
|
3
|
+
exports.Disposable = exports.Unsubscriber = exports.combineDisposers = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const logger_1 = tslib_1.__importDefault(require("./logger"));
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
add(d, id) {
|
|
13
|
-
if (!d) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const dd = typeof d !== 'function'
|
|
17
|
-
? (() => d.dispose ? d.dispose() : null)
|
|
18
|
-
: d;
|
|
19
|
-
this._disposers.push(dd);
|
|
20
|
-
if (id) {
|
|
21
|
-
// dispose previous identified disposer
|
|
22
|
-
if (this._map.has(id)) {
|
|
23
|
-
this.execute(id);
|
|
24
|
-
}
|
|
25
|
-
this._map.set(id, dd);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
execute(id) {
|
|
29
|
-
const d = this._map.get(id);
|
|
30
|
-
if (!d) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
this._map.delete(id);
|
|
34
|
-
const i = this._disposers.indexOf(d);
|
|
35
|
-
if (i >= 0) {
|
|
36
|
-
this._disposers.splice(i, 1);
|
|
37
|
-
}
|
|
38
|
-
d();
|
|
39
|
-
}
|
|
40
|
-
dispose(log = false) {
|
|
41
|
-
if (log) {
|
|
42
|
-
logger_1.default.log(`[Disposer:${this.logName || '<unknown>'}] Disposing ${this._disposers.length} items including named ones:`, Array.from(this._map.entries()).map(e => e[0]));
|
|
43
|
-
}
|
|
44
|
-
this._disposers.forEach(d => d());
|
|
45
|
-
this._disposers.length = 0;
|
|
46
|
-
this._map.clear();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.Unsubscriber = Unsubscriber;
|
|
50
|
-
function combineDisposers(...items) {
|
|
51
|
-
return () => items.forEach(i => i());
|
|
52
|
-
}
|
|
53
|
-
exports.combineDisposers = combineDisposers;
|
|
54
|
-
class Disposable {
|
|
55
|
-
constructor() {
|
|
56
|
-
this.disposer = new Unsubscriber();
|
|
57
|
-
this.dispose = () => this.disposer.dispose();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.Disposable = Disposable;
|
|
6
|
+
var disposer_1 = require("./disposer");
|
|
7
|
+
Object.defineProperty(exports, "combineDisposers", { enumerable: true, get: function () { return disposer_1.combineDisposers; } });
|
|
8
|
+
Object.defineProperty(exports, "Unsubscriber", { enumerable: true, get: function () { return disposer_1.Disposer; } });
|
|
9
|
+
Object.defineProperty(exports, "Disposable", { enumerable: true, get: function () { return disposer_1.Disposable; } });
|
|
10
|
+
logger_1.default.warn('@zajno/common: importing module "unsusbcriber" is deprecated; please change your import to "disposer" module.');
|
|
61
11
|
//# sourceMappingURL=unsubscriber.js.map
|
package/lib/unsubscriber.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsubscriber.js","sourceRoot":"","sources":["../src/unsubscriber.ts"],"names":[],"mappings":";;;;AAAA,8DAA8B;
|
|
1
|
+
{"version":3,"file":"unsubscriber.js","sourceRoot":"","sources":["../src/unsubscriber.ts"],"names":[],"mappings":";;;;AAAA,8DAA8B;AAE9B,uCAMoB;AAHhB,4GAAA,gBAAgB,OAAA;AAChB,wGAAA,QAAQ,OAAgB;AACxB,sGAAA,UAAU,OAAA;AAGd,gBAAM,CAAC,IAAI,CAAC,+GAA+G,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/dates/calc.ts
CHANGED
package/src/dates/convert.ts
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
import { DateX } from './datex';
|
|
2
|
+
import { getDate, getTime } from './parse';
|
|
2
3
|
import { isSame, startOf } from './shift';
|
|
3
4
|
import { ConstantGranularity, Granularity } from './types';
|
|
4
5
|
|
|
5
|
-
export function getTime(d: Date | number): number {
|
|
6
|
-
return d instanceof Date ? d.getTime() : d;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function getDate(d: Date | number | string): Date {
|
|
10
|
-
if (!d) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return new Date(d);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
6
|
type DateFields<T> = {
|
|
18
7
|
[P in keyof T]: T[P] extends Date ? P : never;
|
|
19
8
|
}[keyof T];
|
package/src/dates/format.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as MathX from '../math';
|
|
2
|
-
import { decompose, decomposeDate,
|
|
2
|
+
import { decompose, decomposeDate, getDiscreteDiff } from './convert';
|
|
3
|
+
import { getDate, getTime } from './parse';
|
|
3
4
|
import { YearDate } from './yearDate';
|
|
4
5
|
|
|
5
6
|
export namespace Format {
|
package/src/dates/parse.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
|
|
2
|
+
export function getTime(d: Date | number): number {
|
|
3
|
+
return d instanceof Date ? d.getTime() : d;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function getDate(d: Date | number | string): Date {
|
|
7
|
+
if (!d) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return new Date(d);
|
|
12
|
+
}
|
|
13
|
+
|
|
2
14
|
export namespace Parse {
|
|
3
15
|
/** `YYYY-MM-DD` */
|
|
4
16
|
export function fromDatePicker(str: string, local = false) {
|
package/src/dates/shift.ts
CHANGED
package/src/dates/yearDate.ts
CHANGED
package/src/disposer.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import logger from './logger';
|
|
2
|
+
|
|
3
|
+
export interface IDisposable {
|
|
4
|
+
dispose(): void;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface DisposeFunction {
|
|
8
|
+
(): void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class Disposer {
|
|
12
|
+
|
|
13
|
+
private readonly _disposers: DisposeFunction[] = [];
|
|
14
|
+
private readonly _map = new Map<string, DisposeFunction>();
|
|
15
|
+
|
|
16
|
+
constructor(readonly logName: string = null) { }
|
|
17
|
+
|
|
18
|
+
add(d: DisposeFunction | IDisposable, id?: string) {
|
|
19
|
+
if (!d) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const dd: DisposeFunction = typeof d !== 'function'
|
|
24
|
+
? (() => d.dispose ? d.dispose() : null)
|
|
25
|
+
: d;
|
|
26
|
+
|
|
27
|
+
this._disposers.push(dd);
|
|
28
|
+
|
|
29
|
+
if (id) {
|
|
30
|
+
// dispose previous identified disposer
|
|
31
|
+
if (this._map.has(id)) {
|
|
32
|
+
this.execute(id);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
this._map.set(id, dd);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
execute(id: string) {
|
|
40
|
+
const d = this._map.get(id);
|
|
41
|
+
if (!d) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
this._map.delete(id);
|
|
46
|
+
const i = this._disposers.indexOf(d);
|
|
47
|
+
if (i >= 0) {
|
|
48
|
+
this._disposers.splice(i, 1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
d();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
dispose(log = false) {
|
|
55
|
+
if (log) {
|
|
56
|
+
logger.log(
|
|
57
|
+
`[Disposer:${this.logName || '<unknown>'}] Disposing ${this._disposers.length} items including named ones:`,
|
|
58
|
+
Array.from(this._map.entries()).map(e => e[0]),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this._disposers.forEach(d => d());
|
|
63
|
+
this._disposers.length = 0;
|
|
64
|
+
this._map.clear();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function combineDisposers(...items: DisposeFunction[]): DisposeFunction {
|
|
69
|
+
return () => items.forEach(i => i());
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export class Disposable implements IDisposable {
|
|
73
|
+
|
|
74
|
+
protected readonly disposer = new Disposer();
|
|
75
|
+
protected _isDisposed = false;
|
|
76
|
+
|
|
77
|
+
public dispose = () => {
|
|
78
|
+
this._isDisposed = true;
|
|
79
|
+
this.disposer.dispose();
|
|
80
|
+
};
|
|
81
|
+
}
|
package/src/fields/update.ts
CHANGED
|
@@ -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
|
-
|
|
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/math/calc.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { reaction } from 'mobx';
|
|
2
2
|
import { IEvent, Event } from './event';
|
|
3
3
|
import { ILogger, createLogger } from './logger';
|
|
4
|
-
import { IDisposable } from './
|
|
4
|
+
import { IDisposable } from './disposer';
|
|
5
5
|
|
|
6
6
|
export class TransitionObserver<T> implements IDisposable {
|
|
7
7
|
|
package/src/types.ts
CHANGED
|
@@ -24,3 +24,7 @@ export type Comparator<T, C = boolean> = (v1: T, v2: T) => C;
|
|
|
24
24
|
export namespace Comparator {
|
|
25
25
|
export const Default: Comparator<any> = (a, b) => a === b;
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
export type TypedKeys<T extends Object, K> = {
|
|
29
|
+
[P in keyof T]: T[P] extends K ? P : never
|
|
30
|
+
}[keyof T];
|
package/src/unsubscriber.ts
CHANGED
|
@@ -1,77 +1,11 @@
|
|
|
1
1
|
import logger from './logger';
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
private readonly _disposers: Disposer[] = [];
|
|
14
|
-
private readonly _map = new Map<string, Disposer>();
|
|
15
|
-
|
|
16
|
-
constructor(readonly logName: string = null) { }
|
|
17
|
-
|
|
18
|
-
add(d: Disposer | IDisposable, id?: string) {
|
|
19
|
-
if (!d) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const dd: Disposer = typeof d !== 'function'
|
|
24
|
-
? (() => d.dispose ? d.dispose() : null)
|
|
25
|
-
: d;
|
|
26
|
-
|
|
27
|
-
this._disposers.push(dd);
|
|
28
|
-
|
|
29
|
-
if (id) {
|
|
30
|
-
// dispose previous identified disposer
|
|
31
|
-
if (this._map.has(id)) {
|
|
32
|
-
this.execute(id);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
this._map.set(id, dd);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
execute(id: string) {
|
|
40
|
-
const d = this._map.get(id);
|
|
41
|
-
if (!d) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
this._map.delete(id);
|
|
46
|
-
const i = this._disposers.indexOf(d);
|
|
47
|
-
if (i >= 0) {
|
|
48
|
-
this._disposers.splice(i, 1);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
d();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
dispose(log = false) {
|
|
55
|
-
if (log) {
|
|
56
|
-
logger.log(
|
|
57
|
-
`[Disposer:${this.logName || '<unknown>'}] Disposing ${this._disposers.length} items including named ones:`,
|
|
58
|
-
Array.from(this._map.entries()).map(e => e[0]),
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
this._disposers.forEach(d => d());
|
|
63
|
-
this._disposers.length = 0;
|
|
64
|
-
this._map.clear();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function combineDisposers(...items: Disposer[]): Disposer {
|
|
69
|
-
return () => items.forEach(i => i());
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export class Disposable implements IDisposable {
|
|
73
|
-
|
|
74
|
-
protected readonly disposer = new Unsubscriber();
|
|
75
|
-
|
|
76
|
-
public dispose = () => this.disposer.dispose();
|
|
77
|
-
}
|
|
3
|
+
export {
|
|
4
|
+
IDisposable,
|
|
5
|
+
DisposeFunction as Disposer,
|
|
6
|
+
combineDisposers,
|
|
7
|
+
Disposer as Unsubscriber,
|
|
8
|
+
Disposable,
|
|
9
|
+
} from './disposer';
|
|
10
|
+
|
|
11
|
+
logger.warn('@zajno/common: importing module "unsusbcriber" is deprecated; please change your import to "disposer" module.');
|
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
|
-
"
|
|
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"
|