@avstantso/utils-misc 1.0.3 → 1.1.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.
- package/CHANGELOG.md +12 -0
- package/package.json +7 -7
- package/dist/_global/_register.d.ts +0 -2
- package/dist/_global/async-access-lock.d.ts +0 -35
- package/dist/_global/cases.d.ts +0 -23
- package/dist/_global/custom-string-type.d.ts +0 -131
- package/dist/_global/date-utils.d.ts +0 -26
- package/dist/_global/external-promise.d.ts +0 -36
- package/dist/_global/html-utils.d.ts +0 -32
- package/dist/_global/index.d.ts +0 -9
- package/dist/_global/indirect-new.d.ts +0 -114
- package/dist/_global/instance-proxy.d.ts +0 -97
- package/dist/export.d.ts +0 -9
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -369
- package/dist/index.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.1.0] - 2026-01-18
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Updated all dependencies
|
|
10
|
+
|
|
11
|
+
## [1.0.4] - 2026-01-16
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Updated `@avstantso/core` dependency (fix `process is not defined` error in Vite build)
|
|
16
|
+
|
|
5
17
|
## [1.0.3] - 2026-01-16
|
|
6
18
|
|
|
7
19
|
### Changed
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@avstantso/utils-misc",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"author": "avstantso",
|
|
5
|
-
"version": "1.0
|
|
5
|
+
"version": "1.1.0",
|
|
6
6
|
"description": "AVStantso framework utils misc",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"InstanceProxy"
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"test": "NODE_ENV=test jest --coverage"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@avstantso/concepts": "1.0
|
|
27
|
-
"@avstantso/core": "1.0
|
|
28
|
-
"@avstantso/errors": "1.0
|
|
29
|
-
"@avstantso/js": "1.0
|
|
30
|
-
"@avstantso/std-ext": "1.0
|
|
31
|
-
"@avstantso/ts": "1.0
|
|
26
|
+
"@avstantso/concepts": "1.1.0",
|
|
27
|
+
"@avstantso/core": "1.1.0",
|
|
28
|
+
"@avstantso/errors": "1.1.0",
|
|
29
|
+
"@avstantso/js": "1.1.0",
|
|
30
|
+
"@avstantso/std-ext": "1.1.0",
|
|
31
|
+
"@avstantso/ts": "1.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@avstantso/dev-basic": "1.0.0"
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
declare namespace AVStantso {
|
|
2
|
-
/**
|
|
3
|
-
* @summary Create an asynchronous lock for access to a shared resource.\
|
|
4
|
-
* ≈Critical section for initialization/deinitialization.
|
|
5
|
-
*/
|
|
6
|
-
namespace AsyncAccessLock {
|
|
7
|
-
type Callback = () => Promise<unknown>;
|
|
8
|
-
type IncOrDec = {
|
|
9
|
-
(action: Callback): Promise<unknown>;
|
|
10
|
-
callback(action: Callback): Callback;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* @summary AsyncAccessLock options
|
|
14
|
-
*/
|
|
15
|
-
type Options = AsyncTasksManager.Option;
|
|
16
|
-
}
|
|
17
|
-
interface AsyncAccessLock {
|
|
18
|
-
/**
|
|
19
|
-
* @summary Increment usage
|
|
20
|
-
*/
|
|
21
|
-
inc: AsyncAccessLock.IncOrDec;
|
|
22
|
-
/**
|
|
23
|
-
* @summary Dencrement usage
|
|
24
|
-
*/
|
|
25
|
-
dec: AsyncAccessLock.IncOrDec;
|
|
26
|
-
}
|
|
27
|
-
interface Code {
|
|
28
|
-
/**
|
|
29
|
-
* @summary Create an asynchronous lock for access to a shared resource.\
|
|
30
|
-
* ≈Critical section for initialization/deinitialization.
|
|
31
|
-
*/
|
|
32
|
-
AsyncAccessLock(options?: AVStantso.AsyncAccessLock.Options): AsyncAccessLock;
|
|
33
|
-
}
|
|
34
|
-
const AsyncAccessLock: Code['AsyncAccessLock'];
|
|
35
|
-
}
|
package/dist/_global/cases.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
declare namespace AVStantso {
|
|
2
|
-
const cases: readonly ["camel", "pascal", "snake", "kebab"];
|
|
3
|
-
/**
|
|
4
|
-
* @summary Common cases of naming in code
|
|
5
|
-
*/
|
|
6
|
-
export namespace Cases {
|
|
7
|
-
type Func = (str: string) => string;
|
|
8
|
-
type Key = typeof cases[number];
|
|
9
|
-
type Union = Cases.Key | Cases.Func;
|
|
10
|
-
type Resolve = (caseUnion: Union) => Cases.Func;
|
|
11
|
-
}
|
|
12
|
-
export type Cases = Record<Cases.Key, Cases.Func> & {
|
|
13
|
-
Resolve: Cases.Resolve;
|
|
14
|
-
};
|
|
15
|
-
export interface Code {
|
|
16
|
-
/**
|
|
17
|
-
* @summary Common cases of naming in code
|
|
18
|
-
*/
|
|
19
|
-
Cases: Cases;
|
|
20
|
-
}
|
|
21
|
-
export const Cases: Cases;
|
|
22
|
-
export {};
|
|
23
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
declare namespace AVStantso {
|
|
2
|
-
/**
|
|
3
|
-
* @summary Custom opaque string meta-type
|
|
4
|
-
* @example
|
|
5
|
-
* const Hex24 = CustomStringType(24, (Size) => ({
|
|
6
|
-
* Name: `Hex${Size}`,
|
|
7
|
-
* Strict: true,
|
|
8
|
-
* RegExp: new RegExp(`^[0-9a-fA-F]{${Size}}$`),
|
|
9
|
-
* Gen() {
|
|
10
|
-
* return Array.from(
|
|
11
|
-
* { length: Size },
|
|
12
|
-
* () => Math.floor(Math.random() * 16).toString(16)
|
|
13
|
-
* ).join('');
|
|
14
|
-
* }
|
|
15
|
-
* } as const));
|
|
16
|
-
* type Hex24 = typeof Hex24.Type;
|
|
17
|
-
* @example
|
|
18
|
-
* //import { validate, v4 as uuidv4 } from "uuid";
|
|
19
|
-
* const UUID = CustomStringType({
|
|
20
|
-
* Name: 'UUID',
|
|
21
|
-
* Strict: true,
|
|
22
|
-
* Size: 36,
|
|
23
|
-
* Validate: validate,
|
|
24
|
-
* Gen: uuidv4
|
|
25
|
-
* } as const);
|
|
26
|
-
* type UUID = typeof UUID.Type;
|
|
27
|
-
*/
|
|
28
|
-
namespace CustomStringType {
|
|
29
|
-
/**
|
|
30
|
-
* @summary Metadata of custom opaque string meta-type
|
|
31
|
-
*/
|
|
32
|
-
type Metadata<Size extends number = number> = {
|
|
33
|
-
/**
|
|
34
|
-
* @summary Type name
|
|
35
|
-
*/
|
|
36
|
-
Name: string;
|
|
37
|
-
/**
|
|
38
|
-
* @summary Fixed string size, if setted
|
|
39
|
-
*/
|
|
40
|
-
Size?: Size;
|
|
41
|
-
/**
|
|
42
|
-
* @default true
|
|
43
|
-
*/
|
|
44
|
-
Strict?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* @summary Validation RegExp
|
|
47
|
-
*/
|
|
48
|
-
RegExp?: RegExp;
|
|
49
|
-
/**
|
|
50
|
-
* @summary Validation function
|
|
51
|
-
*/
|
|
52
|
-
Validate?(candidate: string): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* @summary Generate value method, if supported
|
|
55
|
-
*/
|
|
56
|
-
Gen?(): string;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* @summary Type by metadata
|
|
60
|
-
*/
|
|
61
|
-
type Type<M extends Metadata> = TS.Opaque<M['Name'], string>;
|
|
62
|
-
/**
|
|
63
|
-
* @summary Type controller
|
|
64
|
-
*/
|
|
65
|
-
type Controller<Name extends string = string, Size extends number = number, Meta extends Metadata = Metadata, T extends Type<Meta> = Type<Meta>> = {
|
|
66
|
-
/**
|
|
67
|
-
* @summary Cast with check
|
|
68
|
-
*/
|
|
69
|
-
(value: string): T;
|
|
70
|
-
/**
|
|
71
|
-
* @summary Fixed string size
|
|
72
|
-
*/
|
|
73
|
-
readonly Meta: Meta;
|
|
74
|
-
/**
|
|
75
|
-
* @summary Fixed string size
|
|
76
|
-
*/
|
|
77
|
-
readonly Name: Name;
|
|
78
|
-
/**
|
|
79
|
-
* @summary Fixed string size
|
|
80
|
-
*/
|
|
81
|
-
readonly Size: Size;
|
|
82
|
-
/**
|
|
83
|
-
* @summary Designtime only field for `typedef`
|
|
84
|
-
*/
|
|
85
|
-
readonly Type?: T;
|
|
86
|
-
/**
|
|
87
|
-
* @summary Check candidate is T
|
|
88
|
-
*/
|
|
89
|
-
is(candidate: unknown): candidate is T;
|
|
90
|
-
} & (Meta extends {
|
|
91
|
-
Gen(): string;
|
|
92
|
-
} ? {
|
|
93
|
-
/**
|
|
94
|
-
* @summary Generate new value
|
|
95
|
-
*/
|
|
96
|
-
Gen(): T;
|
|
97
|
-
} : unknown);
|
|
98
|
-
}
|
|
99
|
-
namespace Code {
|
|
100
|
-
/**
|
|
101
|
-
* @summary CustomStringType utilities
|
|
102
|
-
*/
|
|
103
|
-
namespace CustomStringType {
|
|
104
|
-
/**
|
|
105
|
-
* @summary Declaration callback for reuse size as const inside
|
|
106
|
-
*/
|
|
107
|
-
type DeclarationCallback<Size extends number = number> = (Size: Size) => AVStantso.CustomStringType.Metadata<Size>;
|
|
108
|
-
}
|
|
109
|
-
interface CustomStringType {
|
|
110
|
-
/**
|
|
111
|
-
* @summary Create CustomStringType by size and metadata from `declarationCallback`
|
|
112
|
-
* @param metadata Metadata for define custom string type
|
|
113
|
-
*/
|
|
114
|
-
<Size extends number, C extends CustomStringType.DeclarationCallback<Size>>(Size: Size, declarationCallback: C): AVStantso.CustomStringType.Controller<ReturnType<C>['Name'], Size, ReturnType<C> & {
|
|
115
|
-
Size: Size;
|
|
116
|
-
}>;
|
|
117
|
-
/**
|
|
118
|
-
* @summary Create CustomStringType by `metadata`
|
|
119
|
-
* @param metadata Metadata for define custom string type
|
|
120
|
-
*/
|
|
121
|
-
<M extends AVStantso.CustomStringType.Metadata>(metadata: M): AVStantso.CustomStringType.Controller<M['Name'], M['Size'], M>;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
interface Code {
|
|
125
|
-
/**
|
|
126
|
-
* @summary CustomStringType utilities
|
|
127
|
-
*/
|
|
128
|
-
CustomStringType: Code.CustomStringType;
|
|
129
|
-
}
|
|
130
|
-
const CustomStringType: Code.CustomStringType;
|
|
131
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
declare namespace AVStantso {
|
|
2
|
-
namespace Code {
|
|
3
|
-
/**
|
|
4
|
-
* @summary Dates utilities
|
|
5
|
-
*/
|
|
6
|
-
interface DateUtils {
|
|
7
|
-
/**
|
|
8
|
-
* @summary Calculate full years of age
|
|
9
|
-
* @param dob Date of birthsday
|
|
10
|
-
* @param to For the specified date. if undefined, Date.now() used
|
|
11
|
-
* @returns Full years of age
|
|
12
|
-
*/
|
|
13
|
-
fullYearOfAge(dob: Date, to?: Date): number;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
interface Code {
|
|
17
|
-
/**
|
|
18
|
-
* @summary Dates utilities
|
|
19
|
-
*/
|
|
20
|
-
DateUtils: Code.DateUtils;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @summary HTML strings utilities
|
|
24
|
-
*/
|
|
25
|
-
const DateUtils: Code.DateUtils;
|
|
26
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
declare namespace AVStantso {
|
|
2
|
-
interface Code {
|
|
3
|
-
/**
|
|
4
|
-
* @summary Create promise and return is's `resolve`, `reject` for external usage
|
|
5
|
-
* @example
|
|
6
|
-
* async function fromExec(command: string, processName: string) {
|
|
7
|
-
* const [promise, resolve, reject] = ExternalPromise();
|
|
8
|
-
*
|
|
9
|
-
* exec(command, (error, stdout, stderr) => {
|
|
10
|
-
* if (error) return reject(error);
|
|
11
|
-
*
|
|
12
|
-
* if (stderr) return reject(new Error(stderr));
|
|
13
|
-
*
|
|
14
|
-
* const processFound = stdout.includes(processName);
|
|
15
|
-
* resolve(processFound);
|
|
16
|
-
* });
|
|
17
|
-
*
|
|
18
|
-
* return promise;
|
|
19
|
-
* }
|
|
20
|
-
*
|
|
21
|
-
* const OSMAP = {
|
|
22
|
-
* win32: async function checkProcessExistsWindows(processName: string) {
|
|
23
|
-
* return fromExec(`tasklist /FI "IMAGENAME eq ${processName}"`, processName);
|
|
24
|
-
* },
|
|
25
|
-
*
|
|
26
|
-
* default: function checkProcessExists(processName: string) {
|
|
27
|
-
* return fromExec(`ps aux | grep "${processName}" | grep -v "grep"`, processName);
|
|
28
|
-
* }
|
|
29
|
-
* };
|
|
30
|
-
*
|
|
31
|
-
* const checkProcessExists = OSMAP[process.platform as keyof typeof OSMAP] || OSMAP.default;
|
|
32
|
-
*/
|
|
33
|
-
ExternalPromise<T>(): [Promise<T>, (value: T) => void, (reason?: any) => void];
|
|
34
|
-
}
|
|
35
|
-
const ExternalPromise: Code['ExternalPromise'];
|
|
36
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
declare namespace AVStantso {
|
|
2
|
-
namespace Code {
|
|
3
|
-
/**
|
|
4
|
-
* @summary HTML strings utilities
|
|
5
|
-
*/
|
|
6
|
-
interface HTMLUtils {
|
|
7
|
-
/**
|
|
8
|
-
* @summary Convert string identifier to valid HTML identifier
|
|
9
|
-
*/
|
|
10
|
-
str2ValidId(id: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* @summary Remove tags from HTML string
|
|
13
|
-
*/
|
|
14
|
-
removeTags(html: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* @summary Hash a string to RGB color in string.\
|
|
17
|
-
* By default add HTML color prefix `#`
|
|
18
|
-
*/
|
|
19
|
-
str2Color(str: string, prefix?: string): string;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
interface Code {
|
|
23
|
-
/**
|
|
24
|
-
* @summary HTML strings utilities
|
|
25
|
-
*/
|
|
26
|
-
HTMLUtils: Code.HTMLUtils;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @summary HTML strings utilities
|
|
30
|
-
*/
|
|
31
|
-
const HTMLUtils: Code.HTMLUtils;
|
|
32
|
-
}
|
package/dist/_global/index.d.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
declare namespace AVStantso {
|
|
2
|
-
/**
|
|
3
|
-
* @summary Indirect `new` lock. Supports class instansi through static method
|
|
4
|
-
* @example
|
|
5
|
-
* type Services = NodeJS.Dict<unknown>;
|
|
6
|
-
* type Options = NodeJS.Dict<unknown>;
|
|
7
|
-
*
|
|
8
|
-
* function Safe(f: Function) {
|
|
9
|
-
* // `Safe` not implemented here
|
|
10
|
-
* return f;
|
|
11
|
-
* }
|
|
12
|
-
*
|
|
13
|
-
* class ExpressControllerOrMiddleware {
|
|
14
|
-
* static #indirectNew = IndirectNew(
|
|
15
|
-
* ExpressControllerOrMiddleware.Create,
|
|
16
|
-
* ExpressControllerOrMiddleware
|
|
17
|
-
* );
|
|
18
|
-
*
|
|
19
|
-
* static Create<
|
|
20
|
-
* TClass extends TS.Class<ExpressControllerOrMiddleware>
|
|
21
|
-
* >(
|
|
22
|
-
* this: TClass,
|
|
23
|
-
* services: Services,
|
|
24
|
-
* options: Options = {}
|
|
25
|
-
* ): InstanceType<TClass> {
|
|
26
|
-
* const release = ExpressControllerOrMiddleware.#indirectNew.acquire();
|
|
27
|
-
* try {
|
|
28
|
-
* return new Proxy(new this(services, options) as InstanceType<TClass>, {
|
|
29
|
-
* get(target, p) {
|
|
30
|
-
* switch (p) {
|
|
31
|
-
* case 'constructor': return target.constructor;
|
|
32
|
-
* }
|
|
33
|
-
*
|
|
34
|
-
* const r: unknown = Reflect.get(target, p);
|
|
35
|
-
* if ('function' !== typeof r)
|
|
36
|
-
* return r;
|
|
37
|
-
*
|
|
38
|
-
* else {
|
|
39
|
-
* // Protect all controller/middleware express methods,
|
|
40
|
-
* // except private ones (starting with `_` | `#`)
|
|
41
|
-
* // and methods without parameters
|
|
42
|
-
* if (r.length > 0 && !/^(_|#)/.test(String(p)))
|
|
43
|
-
* return Safe(r).bind(target);
|
|
44
|
-
* else
|
|
45
|
-
* return r.bind(target);
|
|
46
|
-
* }
|
|
47
|
-
* }
|
|
48
|
-
* });
|
|
49
|
-
* } finally {
|
|
50
|
-
* release();
|
|
51
|
-
* }
|
|
52
|
-
* }
|
|
53
|
-
*
|
|
54
|
-
* constructor(services: Services, options: Options = {}) {
|
|
55
|
-
* ExpressControllerOrMiddleware.#indirectNew.protection();
|
|
56
|
-
* // super(services, options);
|
|
57
|
-
* // or initialization
|
|
58
|
-
* }
|
|
59
|
-
* }
|
|
60
|
-
*/
|
|
61
|
-
export namespace IndirectNew {
|
|
62
|
-
type Class = string | TS.Class;
|
|
63
|
-
type Method = AVStantso_InstanceMethodError.Method;
|
|
64
|
-
}
|
|
65
|
-
export interface IndirectNew {
|
|
66
|
-
/**
|
|
67
|
-
* @summary Protect create from direct `new`
|
|
68
|
-
*/
|
|
69
|
-
protection(instance?: object): void;
|
|
70
|
-
/**
|
|
71
|
-
* @summary Acquire lock for enable create
|
|
72
|
-
* @returns Lock restore method
|
|
73
|
-
*/
|
|
74
|
-
acquire(): () => void;
|
|
75
|
-
}
|
|
76
|
-
class IndirectNewError extends AVStantso_BaseError {
|
|
77
|
-
constructor(Class: IndirectNew.Class, method: IndirectNew.Method, message?: string);
|
|
78
|
-
}
|
|
79
|
-
export namespace Code {
|
|
80
|
-
/**
|
|
81
|
-
* @summary Create indirect `new` lock. Supports class instansi through static method
|
|
82
|
-
* @param method Method for correct creation. Will shown if error.
|
|
83
|
-
* @param Class Class or class name. Will shown if error.
|
|
84
|
-
*/
|
|
85
|
-
interface IndirectNew {
|
|
86
|
-
/**
|
|
87
|
-
* @summary Create indirect `new` lock. Supports class instansi through static method
|
|
88
|
-
* @param method Method for correct creation. Will shown if error.
|
|
89
|
-
* @param Class Class or class name. Will shown if error.
|
|
90
|
-
*/
|
|
91
|
-
(method: IndirectNew.Method, Class?: IndirectNew.Class): AVStantso.IndirectNew;
|
|
92
|
-
/**
|
|
93
|
-
* Check `candidate` is `IndirectNew`
|
|
94
|
-
* @param candidate
|
|
95
|
-
*/
|
|
96
|
-
is(candidate: unknown): candidate is AVStantso.IndirectNew;
|
|
97
|
-
/**
|
|
98
|
-
* Indirect `new` internal error class
|
|
99
|
-
* @param candidate
|
|
100
|
-
*/
|
|
101
|
-
readonly Error: IndirectNewError;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
export interface Code {
|
|
105
|
-
/**
|
|
106
|
-
* @summary Create indirect `new` lock. Supports class instansi through static method
|
|
107
|
-
* @param method Method for correct creation. Will shown if error.
|
|
108
|
-
* @param Class Class or class name. Will shown if error.
|
|
109
|
-
*/
|
|
110
|
-
IndirectNew: Code.IndirectNew;
|
|
111
|
-
}
|
|
112
|
-
export const IndirectNew: Code.IndirectNew;
|
|
113
|
-
export {};
|
|
114
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
declare namespace AVStantso {
|
|
2
|
-
const symbolInstance: unique symbol;
|
|
3
|
-
const symbolSetInstance: unique symbol;
|
|
4
|
-
export namespace InstanceProxy {
|
|
5
|
-
type Instance = object | TS.Func;
|
|
6
|
-
type Wrap<TInstance extends Instance = Instance, R = unknown> = <P extends keyof TInstance>(instance: () => TInstance, p: P) => R;
|
|
7
|
-
namespace Config {
|
|
8
|
-
type Options<TInstance extends Instance = Instance> = {
|
|
9
|
-
original: TInstance;
|
|
10
|
-
wrap?: Wrap<TInstance>;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
type Config = NodeJS.Dict<Instance | Config.Options>;
|
|
14
|
-
type Proxy<TInstance extends Instance = Instance> = TInstance & Proxy.Control<TInstance>;
|
|
15
|
-
namespace Proxy {
|
|
16
|
-
type Control<TInstance extends Instance = Instance> = {
|
|
17
|
-
[symbolInstance]: TInstance;
|
|
18
|
-
[symbolSetInstance](instance: TInstance): void;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
type Result<TConfig extends Config> = {
|
|
22
|
-
[K in keyof TConfig]: TConfig[K] extends Config.Options<any> ? Proxy<TConfig[K]['original']> : Proxy<TConfig[K]>;
|
|
23
|
-
};
|
|
24
|
-
type Key<TProxy extends Proxy> = TProxy extends Proxy<infer TInstance> ? keyof TInstance : never;
|
|
25
|
-
}
|
|
26
|
-
export namespace Code {
|
|
27
|
-
type Instance = AVStantso.InstanceProxy.Instance;
|
|
28
|
-
/**
|
|
29
|
-
* @summary Create instances proxies with old linking by `setInstance`
|
|
30
|
-
* @param config Original instances map
|
|
31
|
-
*/
|
|
32
|
-
export namespace InstanceProxy {
|
|
33
|
-
/**
|
|
34
|
-
* @summary Create instance proxy with old linking by `setInstance`
|
|
35
|
-
* @param original Original instance
|
|
36
|
-
* @param name Original name
|
|
37
|
-
*/
|
|
38
|
-
type Make = <TInstance extends Instance>(original: TInstance, name?: string, wrap?: AVStantso.InstanceProxy.Wrap<TInstance>) => AVStantso.InstanceProxy.Proxy<TInstance>;
|
|
39
|
-
}
|
|
40
|
-
export interface InstanceProxy {
|
|
41
|
-
/**
|
|
42
|
-
* @summary Create instances proxies with old linking by `setInstance`
|
|
43
|
-
* @param config Original instances map
|
|
44
|
-
*/
|
|
45
|
-
<TConfig extends AVStantso.InstanceProxy.Config>(config: TConfig, generalWrap?: AVStantso.InstanceProxy.Wrap): AVStantso.InstanceProxy.Result<TConfig>;
|
|
46
|
-
/**
|
|
47
|
-
* @summary Create instance proxy with old linking by `setInstance`
|
|
48
|
-
* @param original Original instance
|
|
49
|
-
* @param name Original name
|
|
50
|
-
*/
|
|
51
|
-
Make: InstanceProxy.Make;
|
|
52
|
-
/**
|
|
53
|
-
* @summary Create instance proxy config options
|
|
54
|
-
* @param original Original instance
|
|
55
|
-
* @param wrap Wrap property callback
|
|
56
|
-
*/
|
|
57
|
-
Options<TInstance extends Instance = Instance>(original: TInstance, wrap?: AVStantso.InstanceProxy.Wrap<TInstance>): AVStantso.InstanceProxy.Config.Options<TInstance>;
|
|
58
|
-
/**
|
|
59
|
-
* @summary General behavior of all `InstanceProxy` instances.\
|
|
60
|
-
* If `true` — must called `setInstance` for every `InstanceProxy`
|
|
61
|
-
* @default true
|
|
62
|
-
*/
|
|
63
|
-
strict: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* @summary Control symbols
|
|
66
|
-
*/
|
|
67
|
-
Symbol: {
|
|
68
|
-
/**
|
|
69
|
-
* @summary `instance` symbol
|
|
70
|
-
*/
|
|
71
|
-
instance: symbol;
|
|
72
|
-
/**
|
|
73
|
-
* @summary `setInstance` symbol
|
|
74
|
-
*/
|
|
75
|
-
setInstance: symbol;
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* @summary Get `instance` for `proxy`
|
|
79
|
-
*/
|
|
80
|
-
GetInstance<TInstance extends Instance = Instance>(proxy: AVStantso.InstanceProxy.Proxy<TInstance>): TInstance;
|
|
81
|
-
/**
|
|
82
|
-
* @summary Set `instance` for `proxy`
|
|
83
|
-
*/
|
|
84
|
-
SetInstance<TInstance extends Instance = Instance>(proxy: AVStantso.InstanceProxy.Proxy<TInstance>, instance: TInstance): TInstance;
|
|
85
|
-
}
|
|
86
|
-
export {};
|
|
87
|
-
}
|
|
88
|
-
export interface Code {
|
|
89
|
-
/**
|
|
90
|
-
* @summary Create instances proxies with old linking by `setInstance`
|
|
91
|
-
* @param config Original instances map
|
|
92
|
-
*/
|
|
93
|
-
InstanceProxy: Code.InstanceProxy;
|
|
94
|
-
}
|
|
95
|
-
export const InstanceProxy: Code.InstanceProxy;
|
|
96
|
-
export {};
|
|
97
|
-
}
|
package/dist/export.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import InstanceProxy = AVStantso.InstanceProxy;
|
|
2
|
-
import IndirectNew = AVStantso.IndirectNew;
|
|
3
|
-
import AsyncAccessLock = AVStantso.AsyncAccessLock;
|
|
4
|
-
import ExternalPromise = AVStantso.ExternalPromise;
|
|
5
|
-
import CustomStringType = AVStantso.CustomStringType;
|
|
6
|
-
import Cases = AVStantso.Cases;
|
|
7
|
-
import HTMLUtils = AVStantso.HTMLUtils;
|
|
8
|
-
import DateUtils = AVStantso.DateUtils;
|
|
9
|
-
export { InstanceProxy, IndirectNew, AsyncAccessLock, ExternalPromise, CustomStringType, Cases, HTMLUtils, DateUtils };
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('@avstantso/errors');
|
|
4
|
-
require('@avstantso/js');
|
|
5
|
-
require('@avstantso/concepts');
|
|
6
|
-
|
|
7
|
-
var AVStantso$8;
|
|
8
|
-
(function (AVStantso) {
|
|
9
|
-
const symbolInstance = Symbol('instance');
|
|
10
|
-
const symbolSetInstance = Symbol('setInstance');
|
|
11
|
-
AVStantso.InstanceProxy = avstantso._reg.InstanceProxy(({ JS }) => {
|
|
12
|
-
let strictInstanceProxy = true;
|
|
13
|
-
const MakeInstanceProxy = (original, name, wrap) => {
|
|
14
|
-
let instance;
|
|
15
|
-
const instanceName = name || (JS.is.function(original) ? original.name : undefined);
|
|
16
|
-
function getInstance() {
|
|
17
|
-
if (!instance) {
|
|
18
|
-
if (strictInstanceProxy)
|
|
19
|
-
throw new AVStantso_InvalidStateError('InstanceProxy', 'instance', `Need instance. Use InstanceProxy.SetInstance(${instanceName}, <Instance>) for setup instance`);
|
|
20
|
-
return original;
|
|
21
|
-
}
|
|
22
|
-
return instance;
|
|
23
|
-
}
|
|
24
|
-
function setInstance(value) {
|
|
25
|
-
instance = value;
|
|
26
|
-
}
|
|
27
|
-
return new Proxy(original, {
|
|
28
|
-
has: (target, p) => {
|
|
29
|
-
switch (p) {
|
|
30
|
-
case symbolInstance:
|
|
31
|
-
case symbolSetInstance:
|
|
32
|
-
return true;
|
|
33
|
-
default:
|
|
34
|
-
return Reflect.has(getInstance(), p);
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
get: (target, p) => {
|
|
38
|
-
switch (p) {
|
|
39
|
-
case symbolInstance:
|
|
40
|
-
return getInstance();
|
|
41
|
-
case symbolSetInstance:
|
|
42
|
-
return setInstance;
|
|
43
|
-
}
|
|
44
|
-
if (wrap)
|
|
45
|
-
return wrap(getInstance, p);
|
|
46
|
-
const inst = getInstance();
|
|
47
|
-
const r = Reflect.get(inst, p);
|
|
48
|
-
return JS.is.function(r) ? r.bind(inst) : r;
|
|
49
|
-
},
|
|
50
|
-
apply(target, thisArg, argArray) {
|
|
51
|
-
return getInstance().apply(thisArg, argArray);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
function InstanceProxy(config, generalWrap) {
|
|
56
|
-
return Object.fromEntries(Object.entries(config).map(([key, value]) => {
|
|
57
|
-
if ('original' in value && value.original) {
|
|
58
|
-
const { original, wrap } = value;
|
|
59
|
-
return [key, MakeInstanceProxy(original, key, wrap || generalWrap)];
|
|
60
|
-
}
|
|
61
|
-
else
|
|
62
|
-
return [key, MakeInstanceProxy(value, key, generalWrap)];
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
function validateProxy(proxy, symbol) {
|
|
66
|
-
if (!(symbol in proxy))
|
|
67
|
-
throw new AVStantso_NotSupportedError(proxy, String(symbol), 'Passed "proxy" must be a InstanceProxy instance');
|
|
68
|
-
}
|
|
69
|
-
return Object.defineProperties(InstanceProxy, {
|
|
70
|
-
Make: { value: MakeInstanceProxy, writable: false },
|
|
71
|
-
Options: {
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
-
value: (original, wrap) => ({ original, wrap }),
|
|
74
|
-
writable: false
|
|
75
|
-
},
|
|
76
|
-
strict: {
|
|
77
|
-
get: () => strictInstanceProxy,
|
|
78
|
-
set: (value) => (strictInstanceProxy = value)
|
|
79
|
-
},
|
|
80
|
-
Symbol: {
|
|
81
|
-
value: Object.freeze({
|
|
82
|
-
instance: symbolInstance,
|
|
83
|
-
setInstance: symbolSetInstance
|
|
84
|
-
}),
|
|
85
|
-
writable: false
|
|
86
|
-
},
|
|
87
|
-
GetInstance: {
|
|
88
|
-
value(proxy) {
|
|
89
|
-
validateProxy(proxy, symbolInstance);
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
91
|
-
return proxy[symbolInstance];
|
|
92
|
-
},
|
|
93
|
-
writable: false
|
|
94
|
-
},
|
|
95
|
-
SetInstance: {
|
|
96
|
-
value(proxy, instance) {
|
|
97
|
-
validateProxy(proxy, symbolSetInstance);
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
-
proxy[symbolSetInstance](instance);
|
|
100
|
-
return proxy;
|
|
101
|
-
},
|
|
102
|
-
writable: false
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
})(AVStantso$8 || (AVStantso$8 = {}));
|
|
107
|
-
|
|
108
|
-
var AVStantso$7;
|
|
109
|
-
(function (AVStantso) {
|
|
110
|
-
class IndirectNewError extends AVStantso_BaseError {
|
|
111
|
-
constructor(Class, method, message) {
|
|
112
|
-
super(message
|
|
113
|
-
|| `Use "%CN.${'string' === typeof method ? method : method.name}(...)" instead of "new %CN(...)"`.replaceAll('%CN', 'string' === typeof Class ? Class : Class.name));
|
|
114
|
-
Object.assign(this, { Class, method });
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
class IndirectNewLock {
|
|
118
|
-
method;
|
|
119
|
-
Class;
|
|
120
|
-
#locked = true;
|
|
121
|
-
constructor(method, Class) {
|
|
122
|
-
this.method = method;
|
|
123
|
-
this.Class = Class;
|
|
124
|
-
}
|
|
125
|
-
protection(instance) {
|
|
126
|
-
if (!this.#locked)
|
|
127
|
-
return true;
|
|
128
|
-
throw new IndirectNewError(this.Class || instance && Object.getPrototypeOf(instance).constructor || '<class>', this.method);
|
|
129
|
-
}
|
|
130
|
-
#release() {
|
|
131
|
-
this.#locked = true;
|
|
132
|
-
}
|
|
133
|
-
acquire() {
|
|
134
|
-
this.#locked = false;
|
|
135
|
-
return this.#release.bind(this);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
AVStantso.IndirectNew = avstantso._reg.IndirectNew(() => {
|
|
139
|
-
function IndirectNew(method, Class) {
|
|
140
|
-
return Object.seal(new IndirectNewLock(method, Class));
|
|
141
|
-
}
|
|
142
|
-
function isIndirectNew(candidate) {
|
|
143
|
-
return candidate instanceof IndirectNewLock;
|
|
144
|
-
}
|
|
145
|
-
IndirectNew.is = isIndirectNew;
|
|
146
|
-
return Object.defineProperties(IndirectNew, {
|
|
147
|
-
Error: {
|
|
148
|
-
value: IndirectNewError,
|
|
149
|
-
writable: false
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
})(AVStantso$7 || (AVStantso$7 = {}));
|
|
154
|
-
|
|
155
|
-
var AVStantso$6;
|
|
156
|
-
(function (AVStantso) {
|
|
157
|
-
AVStantso.AsyncAccessLock = avstantso._reg.AsyncAccessLock(({ AsyncTasksManager }) => {
|
|
158
|
-
function AsyncAccessLockFactory(options) {
|
|
159
|
-
const manager = (() => {
|
|
160
|
-
const m = options?.manager;
|
|
161
|
-
return !m
|
|
162
|
-
? undefined
|
|
163
|
-
: AsyncTasksManager.is(m)
|
|
164
|
-
? m
|
|
165
|
-
: AsyncTasksManager;
|
|
166
|
-
})();
|
|
167
|
-
const cooperators = [];
|
|
168
|
-
let lock = false, counter = 0;
|
|
169
|
-
function MkAccessLockMethod(dCounter) {
|
|
170
|
-
async function asyncAccessLockRaw(action) {
|
|
171
|
-
if (lock)
|
|
172
|
-
await new Promise((resolve) => cooperators.push(resolve));
|
|
173
|
-
if (dCounter > 0 ? counter < 1 : counter === 1) {
|
|
174
|
-
lock = true;
|
|
175
|
-
try {
|
|
176
|
-
await action();
|
|
177
|
-
counter += dCounter;
|
|
178
|
-
for (const co of cooperators)
|
|
179
|
-
co();
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
lock = false;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
else
|
|
186
|
-
counter += dCounter;
|
|
187
|
-
}
|
|
188
|
-
const asyncAccessLock = manager
|
|
189
|
-
? (action) => manager.regTask(asyncAccessLockRaw(action))
|
|
190
|
-
: asyncAccessLockRaw;
|
|
191
|
-
return Object.assign(asyncAccessLock, {
|
|
192
|
-
callback: (action) => () => asyncAccessLock(action)
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
return { inc: MkAccessLockMethod(1), dec: MkAccessLockMethod(-1) };
|
|
196
|
-
}
|
|
197
|
-
return AsyncAccessLockFactory;
|
|
198
|
-
});
|
|
199
|
-
})(AVStantso$6 || (AVStantso$6 = {}));
|
|
200
|
-
|
|
201
|
-
var AVStantso$5;
|
|
202
|
-
(function (AVStantso) {
|
|
203
|
-
AVStantso.ExternalPromise = avstantso._reg.ExternalPromise(() => {
|
|
204
|
-
return function ExternalPromise() {
|
|
205
|
-
const r = [];
|
|
206
|
-
const promise = new Promise((resolve, reject) => r.push(resolve, reject));
|
|
207
|
-
r.unshift(promise);
|
|
208
|
-
return r;
|
|
209
|
-
};
|
|
210
|
-
});
|
|
211
|
-
})(AVStantso$5 || (AVStantso$5 = {}));
|
|
212
|
-
|
|
213
|
-
var AVStantso$4;
|
|
214
|
-
(function (AVStantso) {
|
|
215
|
-
AVStantso.CustomStringType = avstantso._reg.CustomStringType(({ JS }) => {
|
|
216
|
-
function CustomStringTypeFactory(...params) {
|
|
217
|
-
const Meta = Object.freeze(JS.is.number(params[0]) ? { Size: params[0], ...params[1](params[0]) } : { ...params[0] });
|
|
218
|
-
const { Name, Size, Strict = true, RegExp, Validate, Gen } = Meta;
|
|
219
|
-
function CustomStringTypeController(value) {
|
|
220
|
-
if (undefined === value || null === value)
|
|
221
|
-
return value;
|
|
222
|
-
const s = String(value);
|
|
223
|
-
if (Strict) {
|
|
224
|
-
if (undefined !== Size && Size !== s.length)
|
|
225
|
-
throw new AVStantso_InvalidArgumentError('custom-string-type', 'validate-length', { value }, `${Name} length must be ${Size} but value "${value}" length is ${s.length}`);
|
|
226
|
-
if (RegExp && !RegExp.test(s))
|
|
227
|
-
throw new AVStantso_InvalidArgumentError('custom-string-type', 'validate-reg-exp', { value }, `${Name} must satisfy ${RegExp.source} but value "${value}"`);
|
|
228
|
-
if (Validate && !Validate(s))
|
|
229
|
-
throw new AVStantso_InvalidArgumentError('custom-string-type', 'validate-by-func', { value }, `${Name} must pass validation by ${Validate.name || 'Validate'}. It's fails for value "${value}"`);
|
|
230
|
-
}
|
|
231
|
-
return s;
|
|
232
|
-
}
|
|
233
|
-
function isCustomStringType(candidate) {
|
|
234
|
-
return !!(candidate
|
|
235
|
-
&& JS.is.string(candidate)
|
|
236
|
-
&& (undefined === Size || Size === candidate.length)
|
|
237
|
-
&& (!RegExp || RegExp.test(candidate))
|
|
238
|
-
&& (!Validate || Validate(candidate)));
|
|
239
|
-
}
|
|
240
|
-
return Object.assign(CustomStringTypeController, {
|
|
241
|
-
Meta: Meta,
|
|
242
|
-
Name,
|
|
243
|
-
Size,
|
|
244
|
-
is: isCustomStringType
|
|
245
|
-
}, Gen && { Gen });
|
|
246
|
-
}
|
|
247
|
-
return CustomStringTypeFactory;
|
|
248
|
-
});
|
|
249
|
-
})(AVStantso$4 || (AVStantso$4 = {}));
|
|
250
|
-
|
|
251
|
-
var AVStantso$3;
|
|
252
|
-
(function (AVStantso) {
|
|
253
|
-
const cases = ['camel', 'pascal', 'snake', 'kebab'];
|
|
254
|
-
AVStantso.Cases = avstantso._reg.Cases(({ JS }) => {
|
|
255
|
-
// iOS not supports my old regex: (?<=...)
|
|
256
|
-
// /^[a-z]|[A-Z]|(?<=[^A-Za-z0-9])[a-z0-9]/g,
|
|
257
|
-
const WORDS_REG_EXP = /[A-Z]{2,}(?=[A-Z])(?!=[A-Z])|[A-Z]?[a-z]*[0-9]*/g;
|
|
258
|
-
function Make(changeEachWord, seporator = '') {
|
|
259
|
-
return (str) => {
|
|
260
|
-
if (!str)
|
|
261
|
-
return str;
|
|
262
|
-
const words = Array.from(str.matchAll(WORDS_REG_EXP), (m) => m[0]);
|
|
263
|
-
let r;
|
|
264
|
-
for (let i = 0; i < words.length; i++) {
|
|
265
|
-
const w = words[i];
|
|
266
|
-
if (w)
|
|
267
|
-
r = (!r ? '' : r + seporator) + changeEachWord(w, i);
|
|
268
|
-
}
|
|
269
|
-
return r || '';
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
const cewCap = (word) =>
|
|
273
|
-
// word.toCapitalized is not suitable: need lowercase other letters
|
|
274
|
-
word.charAt(0).toLocaleUpperCase() + word.slice(1).toLocaleLowerCase();
|
|
275
|
-
const cewUncap = (word) => word.toLocaleLowerCase();
|
|
276
|
-
return {
|
|
277
|
-
camel: Make((word, index) => (!index ? cewUncap(word) : cewCap(word))),
|
|
278
|
-
pascal: Make(cewCap),
|
|
279
|
-
snake: Make(cewUncap, '_'),
|
|
280
|
-
kebab: Make(cewUncap, '-'),
|
|
281
|
-
Resolve(caseUnion) {
|
|
282
|
-
if (JS.is.function(caseUnion))
|
|
283
|
-
return caseUnion;
|
|
284
|
-
if (!cases.includes(caseUnion))
|
|
285
|
-
throw new AVStantso_InvalidArgumentError('Cases', 'Resolve', { caseUnion });
|
|
286
|
-
return AVStantso.Cases[caseUnion];
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
});
|
|
290
|
-
})(AVStantso$3 || (AVStantso$3 = {}));
|
|
291
|
-
|
|
292
|
-
var AVStantso$2;
|
|
293
|
-
(function (AVStantso) {
|
|
294
|
-
/**
|
|
295
|
-
* @summary HTML strings utilities
|
|
296
|
-
*/
|
|
297
|
-
AVStantso.HTMLUtils = avstantso._reg.HTMLUtils(() => {
|
|
298
|
-
function str2ValidId(id) {
|
|
299
|
-
if (!id)
|
|
300
|
-
return id;
|
|
301
|
-
return id
|
|
302
|
-
.replace(/@|\^|^[^a-z/]|[^a-z0-9_/-]/gi, ([m]) => {
|
|
303
|
-
switch (m) {
|
|
304
|
-
case '@': return '-at-';
|
|
305
|
-
case '^': return '-hat-';
|
|
306
|
-
default: return '-x-';
|
|
307
|
-
}
|
|
308
|
-
})
|
|
309
|
-
.replace(/-{2,}/g, '-')
|
|
310
|
-
.replace(/-?\/-?/g, '--')
|
|
311
|
-
.replace(/^-+|-+$/g, '');
|
|
312
|
-
}
|
|
313
|
-
function removeTags(html) {
|
|
314
|
-
return html && html.replace(/<\/?[^>]*>?|\/?[^<>]*>/g, '');
|
|
315
|
-
}
|
|
316
|
-
// Source:
|
|
317
|
-
// https://stackoverflow.com/questions/3426404/create-a-hexadecimal-colour-based-on-a-string-with-javascript
|
|
318
|
-
function str2Color(str, prefix = '#') {
|
|
319
|
-
/* eslint-disable no-bitwise */
|
|
320
|
-
let hash = 0;
|
|
321
|
-
(str || '').split('').forEach((char) => {
|
|
322
|
-
hash = char.charCodeAt(0) + ((hash << 5) - hash);
|
|
323
|
-
});
|
|
324
|
-
let color = prefix;
|
|
325
|
-
for (let i = 0; i < 3; i++) {
|
|
326
|
-
const value = (hash >> (i * 8)) & 0xff;
|
|
327
|
-
color += value.toString(16).padStart(2, '0');
|
|
328
|
-
}
|
|
329
|
-
return color;
|
|
330
|
-
/* eslint-enable no-bitwise */
|
|
331
|
-
}
|
|
332
|
-
return { str2ValidId, removeTags, str2Color };
|
|
333
|
-
});
|
|
334
|
-
})(AVStantso$2 || (AVStantso$2 = {}));
|
|
335
|
-
|
|
336
|
-
var AVStantso$1;
|
|
337
|
-
(function (AVStantso) {
|
|
338
|
-
/**
|
|
339
|
-
* @summary HTML strings utilities
|
|
340
|
-
*/
|
|
341
|
-
AVStantso.DateUtils = avstantso._reg.DateUtils(() => {
|
|
342
|
-
function fullYearOfAge(dob, to) {
|
|
343
|
-
const month_diff = (to ? to.getTime() : Date.now()) - dob.getTime();
|
|
344
|
-
const age_dt = new Date(month_diff);
|
|
345
|
-
const year = age_dt.getUTCFullYear();
|
|
346
|
-
return Math.abs(year - 1970);
|
|
347
|
-
}
|
|
348
|
-
return { fullYearOfAge };
|
|
349
|
-
});
|
|
350
|
-
})(AVStantso$1 || (AVStantso$1 = {}));
|
|
351
|
-
|
|
352
|
-
var InstanceProxy = AVStantso.InstanceProxy;
|
|
353
|
-
var IndirectNew = AVStantso.IndirectNew;
|
|
354
|
-
var AsyncAccessLock = AVStantso.AsyncAccessLock;
|
|
355
|
-
var ExternalPromise = AVStantso.ExternalPromise;
|
|
356
|
-
var CustomStringType = AVStantso.CustomStringType;
|
|
357
|
-
var Cases = AVStantso.Cases;
|
|
358
|
-
var HTMLUtils = AVStantso.HTMLUtils;
|
|
359
|
-
var DateUtils = AVStantso.DateUtils;
|
|
360
|
-
|
|
361
|
-
exports.AsyncAccessLock = AsyncAccessLock;
|
|
362
|
-
exports.Cases = Cases;
|
|
363
|
-
exports.CustomStringType = CustomStringType;
|
|
364
|
-
exports.DateUtils = DateUtils;
|
|
365
|
-
exports.ExternalPromise = ExternalPromise;
|
|
366
|
-
exports.HTMLUtils = HTMLUtils;
|
|
367
|
-
exports.IndirectNew = IndirectNew;
|
|
368
|
-
exports.InstanceProxy = InstanceProxy;
|
|
369
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/_global/instance-proxy.ts","../src/_global/indirect-new.ts","../src/_global/async-access-lock.ts","../src/_global/external-promise.ts","../src/_global/custom-string-type.ts","../src/_global/cases.ts","../src/_global/html-utils.ts","../src/_global/date-utils.ts","../src/export.ts"],"sourcesContent":["namespace AVStantso {\n const symbolInstance = Symbol('instance');\n const symbolSetInstance = Symbol('setInstance');\n\n export namespace InstanceProxy {\n export type Instance = object | TS.Func;\n\n export type Wrap<TInstance extends Instance = Instance, R = unknown> = <\n P extends keyof TInstance\n >(\n instance: () => TInstance,\n p: P\n ) => R;\n\n export namespace Config {\n export type Options<TInstance extends Instance = Instance> = {\n original: TInstance;\n wrap?: Wrap<TInstance>;\n };\n }\n export type Config = NodeJS.Dict<Instance | Config.Options>;\n\n export type Proxy<TInstance extends Instance = Instance> = TInstance\n & Proxy.Control<TInstance>;\n\n export namespace Proxy {\n export type Control<TInstance extends Instance = Instance> = {\n [symbolInstance]: TInstance;\n [symbolSetInstance](instance: TInstance): void;\n };\n }\n\n export type Result<TConfig extends Config> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof TConfig]: TConfig[K] extends Config.Options<any>\n ? Proxy<TConfig[K]['original']>\n : Proxy<TConfig[K]>;\n };\n\n export type Key<TProxy extends Proxy> = TProxy extends Proxy<infer TInstance>\n ? keyof TInstance\n : never;\n }\n\n export namespace Code {\n type Instance = AVStantso.InstanceProxy.Instance;\n\n /**\n * @summary Create instances proxies with old linking by `setInstance`\n * @param config Original instances map\n */\n export namespace InstanceProxy {\n /**\n * @summary Create instance proxy with old linking by `setInstance`\n * @param original Original instance\n * @param name Original name\n */\n export type Make = <TInstance extends Instance>(\n original: TInstance,\n name?: string,\n wrap?: AVStantso.InstanceProxy.Wrap<TInstance>\n ) => AVStantso.InstanceProxy.Proxy<TInstance>;\n }\n\n export interface InstanceProxy {\n /**\n * @summary Create instances proxies with old linking by `setInstance`\n * @param config Original instances map\n */\n <TConfig extends AVStantso.InstanceProxy.Config>(\n config: TConfig,\n generalWrap?: AVStantso.InstanceProxy.Wrap\n ): AVStantso.InstanceProxy.Result<TConfig>;\n\n /**\n * @summary Create instance proxy with old linking by `setInstance`\n * @param original Original instance\n * @param name Original name\n */\n Make: InstanceProxy.Make;\n\n /**\n * @summary Create instance proxy config options\n * @param original Original instance\n * @param wrap Wrap property callback\n */\n Options<TInstance extends Instance = Instance>(\n original: TInstance,\n wrap?: AVStantso.InstanceProxy.Wrap<TInstance>\n ): AVStantso.InstanceProxy.Config.Options<TInstance>;\n\n /**\n * @summary General behavior of all `InstanceProxy` instances.\\\n * If `true` — must called `setInstance` for every `InstanceProxy`\n * @default true\n */\n strict: boolean;\n\n /**\n * @summary Control symbols\n */\n Symbol: {\n /**\n * @summary `instance` symbol\n */\n instance: symbol;\n\n /**\n * @summary `setInstance` symbol\n */\n setInstance: symbol;\n },\n\n /**\n * @summary Get `instance` for `proxy`\n */\n GetInstance<TInstance extends Instance = Instance>(\n proxy: AVStantso.InstanceProxy.Proxy<TInstance>,\n ): TInstance;\n\n /**\n * @summary Set `instance` for `proxy`\n */\n SetInstance<TInstance extends Instance = Instance>(\n proxy: AVStantso.InstanceProxy.Proxy<TInstance>,\n instance: TInstance\n ): TInstance;\n }\n }\n\n export interface Code {\n /**\n * @summary Create instances proxies with old linking by `setInstance`\n * @param config Original instances map\n */\n InstanceProxy: Code.InstanceProxy;\n }\n\n export const InstanceProxy: Code.InstanceProxy = avstantso._reg.InstanceProxy(({ JS }) => {\n let strictInstanceProxy = true;\n\n const MakeInstanceProxy: Code.InstanceProxy.Make = (original, name, wrap) => {\n type TInstance = typeof original;\n\n let instance: TInstance;\n const instanceName = name || (JS.is.function(original) ? original.name : undefined);\n\n function getInstance() {\n if (!instance) {\n if (strictInstanceProxy)\n throw new AVStantso_InvalidStateError(\n 'InstanceProxy',\n 'instance',\n `Need instance. Use InstanceProxy.SetInstance(${instanceName\n }, <Instance>) for setup instance`\n );\n\n return original;\n }\n\n return instance;\n }\n\n function setInstance(value: TInstance) {\n instance = value;\n };\n\n return new Proxy(original as InstanceProxy.Proxy<TInstance>, {\n has: (target, p) => {\n switch (p) {\n case symbolInstance:\n case symbolSetInstance:\n return true;\n default:\n return Reflect.has(getInstance(), p);\n }\n },\n get: (target, p) => {\n switch (p) {\n case symbolInstance:\n return getInstance();\n case symbolSetInstance:\n return setInstance;\n }\n\n if (wrap)\n return wrap(getInstance, p as keyof TInstance);\n\n const inst = getInstance();\n const r = Reflect.get(inst, p);\n return JS.is.function(r) ? r.bind(inst) : r;\n },\n apply(target, thisArg, argArray) {\n return (getInstance() as TS.Func).apply(thisArg, argArray);\n }\n });\n };\n\n function InstanceProxy(config: InstanceProxy.Config, generalWrap?: InstanceProxy.Wrap) {\n return Object.fromEntries(\n Object.entries(config).map(([key, value]) => {\n if ('original' in value && value.original) {\n const { original, wrap } = value;\n return [key, MakeInstanceProxy(original, key, wrap || generalWrap)];\n }\n\n else\n return [key, MakeInstanceProxy(value, key, generalWrap)];\n })\n );\n }\n\n function validateProxy(proxy: InstanceProxy.Proxy, symbol: symbol) {\n if (!(symbol in proxy))\n throw new AVStantso_NotSupportedError(\n proxy,\n String(symbol),\n 'Passed \"proxy\" must be a InstanceProxy instance'\n );\n }\n\n return Object.defineProperties(InstanceProxy, {\n Make: { value: MakeInstanceProxy, writable: false },\n\n Options: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: (original: any, wrap?: any) => ({ original, wrap }),\n writable: false\n },\n\n strict: {\n get: () => strictInstanceProxy,\n set: (value: boolean) => (strictInstanceProxy = value)\n },\n\n Symbol: {\n value: Object.freeze({\n instance: symbolInstance,\n setInstance: symbolSetInstance\n }),\n writable: false\n },\n\n GetInstance: {\n value<TInstance extends InstanceProxy.Instance = InstanceProxy.Instance>(\n proxy: AVStantso.InstanceProxy.Proxy<TInstance>\n ): TInstance {\n validateProxy(proxy, symbolInstance);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (proxy as any)[symbolInstance];\n },\n writable: false\n },\n\n SetInstance: {\n value<TInstance extends InstanceProxy.Instance = InstanceProxy.Instance>(\n proxy: AVStantso.InstanceProxy.Proxy<TInstance>,\n instance: TInstance\n ): TInstance {\n validateProxy(proxy, symbolSetInstance);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (proxy as any)[symbolSetInstance](instance);\n\n return proxy;\n },\n writable: false\n }\n\n }) as Code.InstanceProxy;\n });\n}\n","namespace AVStantso {\n /**\n * @summary Indirect `new` lock. Supports class instansi through static method\n * @EXAMPLE(@IndirectNew.ExpressControllerOrMiddleware)\n */\n export namespace IndirectNew {\n export type Class = string | TS.Class;\n export type Method = AVStantso_InstanceMethodError.Method;\n }\n\n export interface IndirectNew {\n /**\n * @summary Protect create from direct `new`\n */\n protection(instance?: object): void;\n\n /**\n * @summary Acquire lock for enable create\n * @returns Lock restore method\n */\n acquire(): () => void;\n }\n\n class IndirectNewError extends AVStantso_BaseError {\n constructor(\n Class: IndirectNew.Class,\n method: IndirectNew.Method,\n message?: string\n ) {\n super(\n message\n || `Use \"%CN.${\n 'string' === typeof method ? method : method.name\n }(...)\" instead of \"new %CN(...)\"`.replaceAll(\n '%CN',\n 'string' === typeof Class ? Class : Class.name\n )\n );\n\n Object.assign(this, { Class, method });\n }\n }\n\n class IndirectNewLock implements IndirectNew {\n #locked = true;\n\n constructor(\n private readonly method: IndirectNew.Method,\n private readonly Class: IndirectNew.Class\n ) {}\n\n protection(instance?: object) {\n if (!this.#locked) return true;\n\n throw new IndirectNewError(\n this.Class || instance && Object.getPrototypeOf(instance).constructor || '<class>',\n this.method\n );\n }\n\n #release() {\n this.#locked = true;\n }\n\n acquire() {\n this.#locked = false;\n return this.#release.bind(this);\n }\n }\n\n export namespace Code {\n /**\n * @summary Create indirect `new` lock. Supports class instansi through static method\n * @param method Method for correct creation. Will shown if error.\n * @param Class Class or class name. Will shown if error.\n */\n export interface IndirectNew {\n /**\n * @summary Create indirect `new` lock. Supports class instansi through static method\n * @param method Method for correct creation. Will shown if error.\n * @param Class Class or class name. Will shown if error.\n */\n (\n method: IndirectNew.Method,\n Class?: IndirectNew.Class\n ): AVStantso.IndirectNew;\n\n /**\n * Check `candidate` is `IndirectNew`\n * @param candidate\n */\n is(candidate: unknown): candidate is AVStantso.IndirectNew;\n\n /**\n * Indirect `new` internal error class\n * @param candidate\n */\n readonly Error: IndirectNewError;\n }\n }\n\n export interface Code {\n /**\n * @summary Create indirect `new` lock. Supports class instansi through static method\n * @param method Method for correct creation. Will shown if error.\n * @param Class Class or class name. Will shown if error.\n */\n IndirectNew: Code.IndirectNew;\n }\n\n export const IndirectNew: Code.IndirectNew = avstantso._reg.IndirectNew(() => {\n function IndirectNew(\n method: IndirectNew.Method,\n Class?: IndirectNew.Class\n ): IndirectNew {\n return Object.seal(new IndirectNewLock(method, Class));\n }\n\n function isIndirectNew(\n candidate: unknown\n ): candidate is IndirectNewLock {\n return candidate instanceof IndirectNewLock;\n };\n IndirectNew.is = isIndirectNew;\n\n return Object.defineProperties(\n IndirectNew,\n {\n Error: {\n value: IndirectNewError,\n writable: false\n }\n }\n ) as unknown as Code.IndirectNew;\n });\n}\n","namespace AVStantso {\n /**\n * @summary Create an asynchronous lock for access to a shared resource.\\\n * ≈Critical section for initialization/deinitialization.\n */\n export namespace AsyncAccessLock {\n export type Callback = () => Promise<unknown>;\n\n export type IncOrDec = {\n (action: Callback): Promise<unknown>;\n\n callback(action: Callback): Callback;\n };\n\n /**\n * @summary AsyncAccessLock options\n */\n export type Options = AsyncTasksManager.Option;\n }\n\n export interface AsyncAccessLock {\n /**\n * @summary Increment usage\n */\n inc: AsyncAccessLock.IncOrDec;\n\n /**\n * @summary Dencrement usage\n */\n dec: AsyncAccessLock.IncOrDec;\n }\n\n export interface Code {\n /**\n * @summary Create an asynchronous lock for access to a shared resource.\\\n * ≈Critical section for initialization/deinitialization.\n */\n AsyncAccessLock(options?: AVStantso.AsyncAccessLock.Options): AsyncAccessLock;\n }\n\n export const AsyncAccessLock: Code['AsyncAccessLock'] = avstantso._reg.AsyncAccessLock(\n ({ AsyncTasksManager }) => {\n function AsyncAccessLockFactory(options: AsyncAccessLock.Options) {\n type CB = AsyncAccessLock.Callback;\n\n const manager = (() => {\n const m = options?.manager;\n return !m\n ? undefined\n : AsyncTasksManager.is(m)\n ? m\n : AsyncTasksManager;\n })();\n\n const cooperators: ((value?: unknown) => void)[] = [];\n let lock = false, counter = 0;\n\n function MkAccessLockMethod(dCounter: -1 | 1) {\n async function asyncAccessLockRaw(action: CB) {\n if (lock)\n await new Promise((resolve) => cooperators.push(resolve));\n\n if (dCounter > 0 ? counter < 1 : counter === 1) {\n lock = true;\n try {\n await action();\n\n counter += dCounter;\n\n for (const co of cooperators)\n co();\n } finally {\n lock = false;\n }\n }\n\n else\n counter += dCounter;\n };\n\n const asyncAccessLock = manager\n ? (action: CB) => manager.regTask(asyncAccessLockRaw(action))\n : asyncAccessLockRaw;\n\n return Object.assign(\n asyncAccessLock,\n {\n callback: (action: CB) => () => asyncAccessLock(action)\n }\n );\n }\n\n return { inc: MkAccessLockMethod(+1), dec: MkAccessLockMethod(-1) };\n }\n\n return AsyncAccessLockFactory;\n });\n}\n","namespace AVStantso {\n export interface Code {\n /**\n * @summary Create promise and return is's `resolve`, `reject` for external usage\n * @EXAMPLE(@ExternalPromise.In.checkProcessExists)\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ExternalPromise<T>(): [Promise<T>, (value: T) => void, (reason?: any) => void];\n }\n\n export const ExternalPromise: Code['ExternalPromise'] = avstantso._reg.ExternalPromise(\n () => {\n return function ExternalPromise() {\n const r = [];\n const promise = new Promise((resolve, reject) => r.push(resolve, reject));\n r.unshift(promise);\n return r;\n } as Code['ExternalPromise'];\n });\n}\n","namespace AVStantso {\n /**\n * @summary Custom opaque string meta-type\n * @EXAMPLE(@CustomStringType.Hex24)\n * @EXAMPLE(@CustomStringType.UUID)\n */\n export namespace CustomStringType {\n /**\n * @summary Metadata of custom opaque string meta-type\n */\n export type Metadata<Size extends number = number> = {\n /**\n * @summary Type name\n */\n Name: string;\n /**\n * @summary Fixed string size, if setted\n */\n Size?: Size;\n\n /**\n * @default true\n */\n Strict?: boolean;\n\n /**\n * @summary Validation RegExp\n */\n RegExp?: RegExp;\n\n /**\n * @summary Validation function\n */\n Validate?(candidate: string): boolean;\n\n /**\n * @summary Generate value method, if supported\n */\n Gen?(): string;\n };\n\n /**\n * @summary Type by metadata\n */\n export type Type<M extends Metadata> = TS.Opaque<M['Name'], string>;\n\n /**\n * @summary Type controller\n */\n export type Controller<\n Name extends string = string,\n Size extends number = number,\n Meta extends Metadata = Metadata,\n T extends Type<Meta> = Type<Meta>\n > = {\n /**\n * @summary Cast with check\n */\n (value: string): T;\n\n /**\n * @summary Fixed string size\n */\n readonly Meta: Meta;\n\n /**\n * @summary Fixed string size\n */\n readonly Name: Name;\n\n /**\n * @summary Fixed string size\n */\n readonly Size: Size;\n\n /**\n * @summary Designtime only field for `typedef`\n */\n readonly Type?: T;\n\n /**\n * @summary Check candidate is T\n */\n is(candidate: unknown): candidate is T;\n } & (Meta extends { Gen(): string } ? {\n /**\n * @summary Generate new value\n */\n Gen(): T;\n } : unknown);\n }\n\n export namespace Code {\n /**\n * @summary CustomStringType utilities\n */\n export namespace CustomStringType {\n /**\n * @summary Declaration callback for reuse size as const inside\n */\n export type DeclarationCallback<Size extends number = number> = (\n Size: Size\n ) => AVStantso.CustomStringType.Metadata<Size>;\n }\n\n export interface CustomStringType {\n /**\n * @summary Create CustomStringType by size and metadata from `declarationCallback`\n * @param metadata Metadata for define custom string type\n */\n <Size extends number, C extends CustomStringType.DeclarationCallback<Size>>(\n Size: Size,\n declarationCallback: C\n ): AVStantso.CustomStringType.Controller<\n ReturnType<C>['Name'],\n Size,\n ReturnType<C> & { Size: Size }\n >;\n\n /**\n * @summary Create CustomStringType by `metadata`\n * @param metadata Metadata for define custom string type\n */\n <M extends AVStantso.CustomStringType.Metadata>(\n metadata: M\n ): AVStantso.CustomStringType.Controller<\n M['Name'],\n M['Size'],\n M\n >;\n }\n }\n\n export interface Code {\n /**\n * @summary CustomStringType utilities\n */\n CustomStringType: Code.CustomStringType;\n }\n\n export const CustomStringType: Code.CustomStringType = avstantso._reg.CustomStringType(\n ({ JS }) => {\n function CustomStringTypeFactory(...params: TS.Arr) {\n const Meta = Object.freeze(\n JS.is.number(params[0]) ? { Size: params[0], ...params[1](params[0]) } : { ...params[0] }\n );\n const { Name, Size, Strict = true, RegExp, Validate, Gen } = Meta;\n\n function CustomStringTypeController(value: string): string {\n if (undefined === value || null === value) return value;\n\n const s = String(value);\n if (Strict){\n if (undefined !== Size && Size !== s.length)\n throw new AVStantso_InvalidArgumentError(\n 'custom-string-type',\n 'validate-length',\n { value },\n `${Name} length must be ${Size\n } but value \"${value}\" length is ${s.length}`\n );\n\n if (RegExp && !RegExp.test(s))\n throw new AVStantso_InvalidArgumentError(\n 'custom-string-type',\n 'validate-reg-exp',\n { value },\n `${Name} must satisfy ${RegExp.source\n } but value \"${value}\"`\n );\n\n if (Validate && !Validate(s))\n throw new AVStantso_InvalidArgumentError(\n 'custom-string-type',\n 'validate-by-func',\n { value },\n `${Name} must pass validation by ${Validate.name || 'Validate'\n }. It's fails for value \"${value}\"`\n );\n }\n\n return s;\n }\n\n function isCustomStringType(candidate: unknown) {\n return !!(candidate\n && JS.is.string(candidate)\n && (undefined === Size || Size === candidate.length)\n && (!RegExp || RegExp.test(candidate))\n && (!Validate || Validate(candidate)));\n };\n\n return Object.assign(\n CustomStringTypeController,\n {\n Meta: Meta,\n Name,\n Size,\n is: isCustomStringType\n },\n Gen && { Gen }\n );\n }\n\n return CustomStringTypeFactory as unknown as Code.CustomStringType;\n });\n}\n","namespace AVStantso {\n const cases = ['camel', 'pascal', 'snake', 'kebab'] as const;\n\n /**\n * @summary Common cases of naming in code\n */\n export namespace Cases {\n export type Func = (str: string) => string;\n\n export type Key = typeof cases[number];\n\n export type Union = Cases.Key | Cases.Func;\n\n export type Resolve = (caseUnion: Union) => Cases.Func;\n }\n\n export type Cases = Record<Cases.Key, Cases.Func> & { Resolve: Cases.Resolve };\n\n export interface Code {\n /**\n * @summary Common cases of naming in code\n */\n Cases: Cases;\n }\n\n export const Cases: Cases = avstantso._reg.Cases(({ JS }) => {\n type ChangeEachWord = (word: string, index?: number) => string;\n\n // iOS not supports my old regex: (?<=...)\n // /^[a-z]|[A-Z]|(?<=[^A-Za-z0-9])[a-z0-9]/g,\n\n const WORDS_REG_EXP = /[A-Z]{2,}(?=[A-Z])(?!=[A-Z])|[A-Z]?[a-z]*[0-9]*/g;\n\n function Make(changeEachWord: ChangeEachWord, seporator = ''): Cases.Func {\n return (str) => {\n if (!str) return str;\n\n const words = Array.from(\n str.matchAll(WORDS_REG_EXP),\n (m) => m[0]\n );\n\n let r: string;\n for (let i = 0; i < words.length; i++) {\n const w = words[i];\n if (w) r = (!r ? '' : r + seporator) + changeEachWord(w, i);\n }\n\n return r || '';\n };\n }\n\n const cewCap: ChangeEachWord = (word) =>\n // word.toCapitalized is not suitable: need lowercase other letters\n word.charAt(0).toLocaleUpperCase() + word.slice(1).toLocaleLowerCase();\n\n const cewUncap: ChangeEachWord = (word) =>\n word.toLocaleLowerCase();\n\n return {\n camel: Make((word, index) => (!index ? cewUncap(word) : cewCap(word))),\n pascal: Make(cewCap),\n snake: Make(cewUncap, '_'),\n kebab: Make(cewUncap, '-'),\n\n Resolve(caseUnion) {\n if (JS.is.function(caseUnion)) return caseUnion;\n\n if (!cases.includes(caseUnion))\n throw new AVStantso_InvalidArgumentError(\n 'Cases',\n 'Resolve',\n { caseUnion }\n );\n\n return Cases[caseUnion];\n }\n };\n });\n}\n","namespace AVStantso {\n export namespace Code {\n /**\n * @summary HTML strings utilities\n */\n export interface HTMLUtils {\n /**\n * @summary Convert string identifier to valid HTML identifier\n */\n str2ValidId(id: string): string;\n\n /**\n * @summary Remove tags from HTML string\n */\n removeTags(html: string): string;\n\n /**\n * @summary Hash a string to RGB color in string.\\\n * By default add HTML color prefix `#`\n */\n str2Color(str: string, prefix?: string): string\n }\n }\n\n export interface Code {\n /**\n * @summary HTML strings utilities\n */\n HTMLUtils: Code.HTMLUtils;\n }\n\n /**\n * @summary HTML strings utilities\n */\n export const HTMLUtils: Code.HTMLUtils = avstantso._reg.HTMLUtils(() => {\n function str2ValidId(id: string) {\n if (!id) return id;\n\n return id\n .replace(/@|\\^|^[^a-z/]|[^a-z0-9_/-]/gi, ([m]) => {\n switch (m) {\n case '@': return '-at-';\n case '^': return '-hat-';\n default: return '-x-';\n }\n })\n .replace(/-{2,}/g, '-')\n .replace(/-?\\/-?/g, '--')\n .replace(/^-+|-+$/g, '');\n }\n\n function removeTags(html: string) {\n return html && html.replace(/<\\/?[^>]*>?|\\/?[^<>]*>/g, '');\n }\n\n // Source:\n // https://stackoverflow.com/questions/3426404/create-a-hexadecimal-colour-based-on-a-string-with-javascript\n function str2Color(str: string, prefix = '#') {\n /* eslint-disable no-bitwise */\n let hash = 0;\n (str || '').split('').forEach((char) => {\n hash = char.charCodeAt(0) + ((hash << 5) - hash);\n });\n\n let color = prefix;\n for (let i = 0; i < 3; i++) {\n const value = (hash >> (i * 8)) & 0xff;\n color += value.toString(16).padStart(2, '0');\n }\n\n return color;\n /* eslint-enable no-bitwise */\n }\n\n return { str2ValidId, removeTags, str2Color };\n });\n}\n","namespace AVStantso {\n export namespace Code {\n /**\n * @summary Dates utilities\n */\n export interface DateUtils {\n /**\n * @summary Calculate full years of age\n * @param dob Date of birthsday\n * @param to For the specified date. if undefined, Date.now() used\n * @returns Full years of age\n */\n fullYearOfAge(dob: Date, to?: Date): number;\n }\n }\n\n export interface Code {\n /**\n * @summary Dates utilities\n */\n DateUtils: Code.DateUtils;\n }\n\n /**\n * @summary HTML strings utilities\n */\n export const DateUtils: Code.DateUtils = avstantso._reg.DateUtils(() => {\n function fullYearOfAge(dob: Date, to?: Date): number {\n const month_diff = (to ? to.getTime() : Date.now()) - dob.getTime();\n const age_dt = new Date(month_diff);\n const year = age_dt.getUTCFullYear();\n return Math.abs(year - 1970);\n }\n\n return { fullYearOfAge };\n });\n}\n","import InstanceProxy = AVStantso.InstanceProxy;\nimport IndirectNew = AVStantso.IndirectNew;\nimport AsyncAccessLock = AVStantso.AsyncAccessLock;\nimport ExternalPromise = AVStantso.ExternalPromise;\nimport CustomStringType = AVStantso.CustomStringType;\nimport Cases = AVStantso.Cases;\nimport HTMLUtils = AVStantso.HTMLUtils;\nimport DateUtils = AVStantso.DateUtils;\n\nexport {\n InstanceProxy,\n IndirectNew,\n As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