@vorplex/core 0.0.4 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/consts/mime-type.const.d.ts +456 -0
- package/dist/consts/mime-type.const.js +456 -0
- package/dist/consts/unit.const.d.ts +22 -0
- package/dist/consts/unit.const.js +22 -0
- package/dist/functions/debounce.function.d.ts +1 -0
- package/dist/functions/debounce.function.js +12 -0
- package/dist/functions/is-node-environment.function.d.ts +1 -0
- package/dist/functions/is-node-environment.function.js +3 -0
- package/dist/functions/parse-path-selector.function.d.ts +2 -0
- package/dist/functions/parse-path-selector.function.js +17 -0
- package/dist/functions/parse-url.function.d.ts +12 -0
- package/dist/functions/parse-url.function.js +25 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +93 -0
- package/dist/interfaces/group.interface.d.ts +4 -0
- package/dist/interfaces/group.interface.js +0 -0
- package/dist/interfaces/key-value.interface.d.ts +4 -0
- package/dist/interfaces/key-value.interface.js +0 -0
- package/dist/modules/api/socket.model.d.ts +26 -0
- package/dist/modules/api/socket.model.js +66 -0
- package/dist/modules/api/web-client.model.d.ts +16 -0
- package/dist/modules/api/web-client.model.js +34 -0
- package/dist/modules/array/array.util.d.ts +17 -0
- package/dist/modules/array/array.util.js +105 -0
- package/dist/modules/changes/changes.util.d.ts +45 -0
- package/dist/modules/changes/changes.util.js +330 -0
- package/dist/modules/color/color-data.interface.d.ts +10 -0
- package/dist/modules/color/color-data.interface.js +0 -0
- package/dist/modules/color/color-formats.const.d.ts +9 -0
- package/dist/modules/color/color-formats.const.js +8 -0
- package/dist/modules/color/color.type.d.ts +4 -0
- package/dist/modules/color/color.type.js +0 -0
- package/dist/modules/color/color.util.d.ts +41 -0
- package/dist/modules/color/color.util.js +327 -0
- package/dist/modules/color/colors.const.d.ts +151 -0
- package/dist/modules/color/colors.const.js +150 -0
- package/dist/modules/color/hsl.interface.d.ts +6 -0
- package/dist/modules/color/hsl.interface.js +0 -0
- package/dist/modules/color/hsv.interface.d.ts +6 -0
- package/dist/modules/color/hsv.interface.js +0 -0
- package/dist/modules/color/rgb.interface.d.ts +6 -0
- package/dist/modules/color/rgb.interface.js +0 -0
- package/dist/modules/compression/compression.util.d.ts +4 -0
- package/dist/modules/compression/compression.util.js +52 -0
- package/dist/modules/date/date.util.d.ts +37 -0
- package/dist/modules/date/date.util.js +84 -0
- package/dist/modules/enum/enum.util.d.ts +17 -0
- package/dist/modules/enum/enum.util.js +69 -0
- package/dist/modules/hash/hash.util.d.ts +3 -0
- package/dist/modules/hash/hash.util.js +9 -0
- package/dist/modules/id/id.util.d.ts +7 -0
- package/dist/modules/id/id.util.js +33 -0
- package/dist/modules/injector/decorators/inject-token.decorator.d.ts +14 -0
- package/dist/modules/injector/decorators/inject-token.decorator.js +12 -0
- package/dist/modules/injector/decorators/injectable.decorator.d.ts +9 -0
- package/dist/modules/injector/decorators/injectable.decorator.js +7 -0
- package/dist/modules/injector/injector.model.d.ts +25 -0
- package/dist/modules/injector/injector.model.js +152 -0
- package/dist/modules/injector/provider-scopes.enum.d.ts +5 -0
- package/dist/modules/injector/provider-scopes.enum.js +6 -0
- package/dist/modules/injector/provider.interface.d.ts +10 -0
- package/dist/modules/injector/provider.interface.js +0 -0
- package/dist/modules/json-filter/json-filter.function.d.ts +41 -0
- package/dist/modules/json-filter/json-filter.function.js +75 -0
- package/dist/modules/logging/console-logger.model.d.ts +36 -0
- package/dist/modules/logging/console-logger.model.js +44 -0
- package/dist/modules/logging/logger.model.d.ts +6 -0
- package/dist/modules/logging/logger.model.js +7 -0
- package/dist/modules/logging/task.d.ts +38 -0
- package/dist/modules/logging/task.js +133 -0
- package/dist/modules/math/line.d.ts +12 -0
- package/dist/modules/math/line.js +50 -0
- package/dist/modules/math/point.d.ts +34 -0
- package/dist/modules/math/point.js +71 -0
- package/dist/modules/math/polygon.d.ts +45 -0
- package/dist/modules/math/polygon.js +273 -0
- package/dist/modules/math/rect.d.ts +6 -0
- package/dist/modules/math/rect.js +0 -0
- package/dist/modules/math/size.d.ts +4 -0
- package/dist/modules/math/size.js +0 -0
- package/dist/modules/number/number.util.d.ts +9 -0
- package/dist/modules/number/number.util.js +27 -0
- package/dist/modules/object/object.util.d.ts +7 -0
- package/dist/modules/object/object.util.js +63 -0
- package/dist/modules/path/path.util.d.ts +11 -0
- package/dist/modules/path/path.util.js +59 -0
- package/dist/modules/random/random.util.d.ts +17 -0
- package/dist/modules/random/random.util.js +57 -0
- package/dist/modules/readable-stream/readable-stream.util.d.ts +3 -0
- package/dist/modules/readable-stream/readable-stream.util.js +26 -0
- package/dist/modules/reflection/interfaces/parameter.interface.d.ts +4 -0
- package/dist/modules/reflection/interfaces/parameter.interface.js +0 -0
- package/dist/modules/reflection/models/attribute.model.d.ts +12 -0
- package/dist/modules/reflection/models/attribute.model.js +17 -0
- package/dist/modules/reflection/models/class-attribute.model.d.ts +4 -0
- package/dist/modules/reflection/models/class-attribute.model.js +6 -0
- package/dist/modules/reflection/models/method-attribute.model.d.ts +5 -0
- package/dist/modules/reflection/models/method-attribute.model.js +8 -0
- package/dist/modules/reflection/models/parameter-attribute.model.d.ts +7 -0
- package/dist/modules/reflection/models/parameter-attribute.model.js +21 -0
- package/dist/modules/reflection/models/property-attribute.model.d.ts +5 -0
- package/dist/modules/reflection/models/property-attribute.model.js +8 -0
- package/dist/modules/reflection/models/property-proxy-attribute.model.d.ts +15 -0
- package/dist/modules/reflection/models/property-proxy-attribute.model.js +19 -0
- package/dist/modules/reflection/types/constructor.type.d.ts +2 -0
- package/dist/modules/reflection/types/constructor.type.js +0 -0
- package/dist/modules/reflection/types/instance.type.d.ts +7 -0
- package/dist/modules/reflection/types/instance.type.js +0 -0
- package/dist/modules/reflection/types/type.type.d.ts +2 -0
- package/dist/modules/reflection/types/type.type.js +0 -0
- package/dist/modules/reflection/utils/decorator.util.d.ts +70 -0
- package/dist/modules/reflection/utils/decorator.util.js +135 -0
- package/dist/modules/reflection/utils/reflection.util.d.ts +140 -0
- package/dist/modules/reflection/utils/reflection.util.js +311 -0
- package/dist/modules/router/router.util.d.ts +33 -0
- package/dist/modules/router/router.util.js +59 -0
- package/dist/modules/state/adaptors/array/array-adaptor.util.d.ts +25 -0
- package/dist/modules/state/adaptors/array/array-adaptor.util.js +97 -0
- package/dist/modules/state/adaptors/entity/entity-adaptor.util.d.ts +35 -0
- package/dist/modules/state/adaptors/entity/entity-adaptor.util.js +158 -0
- package/dist/modules/state/adaptors/entity/entity-map.type.d.ts +4 -0
- package/dist/modules/state/adaptors/entity/entity-map.type.js +0 -0
- package/dist/modules/state/adaptors/entity/entity.interface.d.ts +3 -0
- package/dist/modules/state/adaptors/entity/entity.interface.js +0 -0
- package/dist/modules/state/state.model.d.ts +46 -0
- package/dist/modules/state/state.model.js +129 -0
- package/dist/modules/state/update.type.d.ts +2 -0
- package/dist/modules/state/update.type.js +0 -0
- package/dist/modules/string/string.util.d.ts +11 -0
- package/dist/modules/string/string.util.js +42 -0
- package/dist/modules/subscribable/subscribable.model.d.ts +10 -0
- package/dist/modules/subscribable/subscribable.model.js +34 -0
- package/dist/modules/subscribable/subscription.interface.d.ts +3 -0
- package/dist/modules/subscribable/subscription.interface.js +0 -0
- package/dist/modules/tson/error.d.ts +8 -0
- package/dist/modules/tson/error.js +13 -0
- package/dist/modules/tson/schema.d.ts +10 -0
- package/dist/modules/tson/schema.js +0 -0
- package/dist/modules/tson/schemas/any.d.ts +14 -0
- package/dist/modules/tson/schemas/any.js +27 -0
- package/dist/modules/tson/schemas/array.d.ts +21 -0
- package/dist/modules/tson/schemas/array.js +80 -0
- package/dist/modules/tson/schemas/boolean.d.ts +14 -0
- package/dist/modules/tson/schemas/boolean.js +38 -0
- package/dist/modules/tson/schemas/enum.d.ts +15 -0
- package/dist/modules/tson/schemas/enum.js +43 -0
- package/dist/modules/tson/schemas/number.d.ts +20 -0
- package/dist/modules/tson/schemas/number.js +66 -0
- package/dist/modules/tson/schemas/object.d.ts +33 -0
- package/dist/modules/tson/schemas/object.js +88 -0
- package/dist/modules/tson/schemas/schema-base.d.ts +12 -0
- package/dist/modules/tson/schemas/schema-base.js +14 -0
- package/dist/modules/tson/schemas/string.d.ts +19 -0
- package/dist/modules/tson/schemas/string.js +60 -0
- package/dist/modules/tson/schemas/union.d.ts +16 -0
- package/dist/modules/tson/schemas/union.js +56 -0
- package/dist/modules/tson/tson.d.ts +41 -0
- package/dist/modules/tson/tson.js +138 -0
- package/dist/modules/tson/type.d.ts +53 -0
- package/dist/modules/tson/type.js +0 -0
- package/dist/modules/value/value.util.d.ts +18 -0
- package/dist/modules/value/value.util.js +180 -0
- package/dist/types/awaitable.type.d.ts +1 -0
- package/dist/types/awaitable.type.js +0 -0
- package/dist/types/camel-to-kebab.type.d.ts +1 -0
- package/dist/types/camel-to-kebab.type.js +0 -0
- package/dist/types/has-key.type.d.ts +3 -0
- package/dist/types/has-key.type.js +0 -0
- package/dist/types/is-union.type.d.ts +1 -0
- package/dist/types/is-union.type.js +0 -0
- package/dist/types/keys-of-type.type.d.ts +5 -0
- package/dist/types/keys-of-type.type.js +0 -0
- package/dist/types/keys-with-fix.type.d.ts +3 -0
- package/dist/types/keys-with-fix.type.js +0 -0
- package/dist/types/optional-keys.type.d.ts +6 -0
- package/dist/types/optional-keys.type.js +0 -0
- package/dist/types/partial.type.d.ts +6 -0
- package/dist/types/partial.type.js +0 -0
- package/dist/types/predicate.type.d.ts +1 -0
- package/dist/types/predicate.type.js +0 -0
- package/dist/types/recursive-readonly.type.d.ts +3 -0
- package/dist/types/recursive-readonly.type.js +0 -0
- package/dist/types/recursive-value.type.d.ts +3 -0
- package/dist/types/recursive-value.type.js +0 -0
- package/dist/types/selector.type.d.ts +1 -0
- package/dist/types/selector.type.js +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { HasKey } from '../../types/has-key.type';
|
|
2
|
+
import { IsUnion } from '../../types/is-union.type';
|
|
3
|
+
import type { TsonDefinition } from './schema';
|
|
4
|
+
import type { TsonArrayDefinition } from './schemas/array';
|
|
5
|
+
import type { TsonBooleanDefinition } from './schemas/boolean';
|
|
6
|
+
import type { TsonEnumDefinition } from './schemas/enum';
|
|
7
|
+
import type { TsonNumberDefinition } from './schemas/number';
|
|
8
|
+
import type { TsonObjectDefinition } from './schemas/object';
|
|
9
|
+
import type { TsonStringDefinition } from './schemas/string';
|
|
10
|
+
import type { TsonUnionDefinition } from './schemas/union';
|
|
11
|
+
export type TsonTupleType<T extends readonly TsonDefinition[], Result = never> = T extends readonly [infer Head, ...infer Tail] ? (Tail extends readonly TsonDefinition[] ? TsonTupleType<Tail, Result | (Head extends TsonDefinition ? TsonType<Head> : never)> : never) : Result;
|
|
12
|
+
type OptionalKeys<T> = {
|
|
13
|
+
[K in keyof T]: HasKey<T[K], 'default'> extends true ? K : never;
|
|
14
|
+
}[keyof T];
|
|
15
|
+
type RequiredKeys<T> = {
|
|
16
|
+
[K in keyof T]: HasKey<T[K], 'default'> extends false ? K : never;
|
|
17
|
+
}[keyof T];
|
|
18
|
+
type ObjectType<T> = {
|
|
19
|
+
[K in keyof T]: T[K];
|
|
20
|
+
};
|
|
21
|
+
type TsonObjectType<T extends Record<string, TsonDefinition>> = ObjectType<{
|
|
22
|
+
[P in RequiredKeys<T>]: TsonType<T[P]>;
|
|
23
|
+
} & {
|
|
24
|
+
[P in OptionalKeys<T>]?: TsonType<T[P]>;
|
|
25
|
+
}>;
|
|
26
|
+
export type TsonType<T extends TsonDefinition | readonly TsonDefinition[]> = T extends {
|
|
27
|
+
type: 'any';
|
|
28
|
+
} ? any : T extends {
|
|
29
|
+
type: 'string';
|
|
30
|
+
} ? string : T extends {
|
|
31
|
+
type: 'number';
|
|
32
|
+
} ? number : T extends {
|
|
33
|
+
type: 'boolean';
|
|
34
|
+
} ? boolean : T extends {
|
|
35
|
+
type: 'enum';
|
|
36
|
+
flags: (infer Flags)[];
|
|
37
|
+
} ? Flags : T extends {
|
|
38
|
+
type: 'array';
|
|
39
|
+
itemDefinition: infer Item extends TsonDefinition;
|
|
40
|
+
} ? TsonType<Item>[] : T extends {
|
|
41
|
+
type: 'array';
|
|
42
|
+
} ? any[] : T extends {
|
|
43
|
+
type: "object";
|
|
44
|
+
properties: infer P extends Record<string, TsonDefinition>;
|
|
45
|
+
} ? TsonObjectType<P> : T extends {
|
|
46
|
+
type: 'object';
|
|
47
|
+
property: infer P extends TsonDefinition;
|
|
48
|
+
} ? Record<string, TsonType<P>> : T extends {
|
|
49
|
+
type: 'union';
|
|
50
|
+
union: infer Union extends readonly TsonDefinition[];
|
|
51
|
+
} ? TsonTupleType<Union> : T extends readonly TsonDefinition[] ? TsonType<TsonTupleType<T>> : never;
|
|
52
|
+
export type TypeTson<T> = unknown extends T ? TsonDefinition : [T] extends [string] ? TsonStringDefinition | TsonEnumDefinition<T> : [T] extends [number] ? TsonNumberDefinition | TsonEnumDefinition<T> : [T] extends [boolean] ? TsonBooleanDefinition : [T] extends [(infer Item)[]] ? TsonArrayDefinition<Item> : [T] extends [object] ? TsonObjectDefinition<T> : IsUnion<T> extends true ? (T extends readonly any[] ? TsonUnionDefinition<T> : never) : never;
|
|
53
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Update } from '../state/update.type';
|
|
2
|
+
export declare class $Value {
|
|
3
|
+
static isNumeric(value: any): boolean;
|
|
4
|
+
static update<T extends object, V>(target: T, pathSelector: (value: T) => V, update: Update<V>): T;
|
|
5
|
+
static set<T extends object, V>(target: T, pathSelector: (value: T) => V, update: NoInfer<V> | ((value: V) => NoInfer<V>)): T;
|
|
6
|
+
static set<T = any>(target: T, path: string, value: any): T;
|
|
7
|
+
static unset(target: any, path: string): void;
|
|
8
|
+
static get(value: any, path: string): any;
|
|
9
|
+
static equals(a: any, b: any): boolean;
|
|
10
|
+
static clone<T>(value: T): T;
|
|
11
|
+
static pick(target: Record<string, any>, options: {
|
|
12
|
+
include?: string[];
|
|
13
|
+
exclude?: string[];
|
|
14
|
+
}): {
|
|
15
|
+
[x: string]: any;
|
|
16
|
+
};
|
|
17
|
+
static orderProperties<T>(value: T): T;
|
|
18
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { parsePath, parsePathSelector } from '../../functions/parse-path-selector.function';
|
|
2
|
+
import { State } from '../state/state.model';
|
|
3
|
+
import { $String } from '../string/string.util';
|
|
4
|
+
export class $Value {
|
|
5
|
+
static isNumeric(value) {
|
|
6
|
+
return !isNaN(parseInt(value));
|
|
7
|
+
}
|
|
8
|
+
static update(target, pathSelector, update) {
|
|
9
|
+
const path = parsePathSelector(pathSelector);
|
|
10
|
+
const isUnassigned = (value) => value == null || typeof value !== 'object';
|
|
11
|
+
const updateAtPath = (value, pathIndex) => {
|
|
12
|
+
if (pathIndex === path.length)
|
|
13
|
+
return State.update(value, update);
|
|
14
|
+
const key = path[pathIndex];
|
|
15
|
+
let nextValue = value?.[key];
|
|
16
|
+
if (isUnassigned(nextValue) && pathIndex < path.length - 1) {
|
|
17
|
+
const nextKey = path[pathIndex + 1];
|
|
18
|
+
nextValue = $Value.isNumeric(nextKey) ? [] : {};
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
const array = [...value];
|
|
22
|
+
array[Number(key)] = updateAtPath(nextValue, pathIndex + 1);
|
|
23
|
+
return array;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
...(value || {}),
|
|
27
|
+
[key]: updateAtPath(nextValue, pathIndex + 1)
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
return updateAtPath(target, 0);
|
|
31
|
+
}
|
|
32
|
+
static set(target, path, value) {
|
|
33
|
+
if ($String.isNullOrEmpty(path))
|
|
34
|
+
return value;
|
|
35
|
+
const selectors = typeof path === 'string' ? parsePath(path) : parsePathSelector(path);
|
|
36
|
+
const isUnassigned = (value) => value == null || typeof value !== 'object';
|
|
37
|
+
if (isUnassigned(target))
|
|
38
|
+
target = ($Value.isNumeric(selectors[0]) ? [] : {});
|
|
39
|
+
let currentTarget = target;
|
|
40
|
+
for (let i = 0; i < selectors.length - 1; i++) {
|
|
41
|
+
const key = selectors[i];
|
|
42
|
+
const nextKey = selectors[i + 1];
|
|
43
|
+
if (isUnassigned(currentTarget[key])) {
|
|
44
|
+
currentTarget[key] = $Value.isNumeric(nextKey) ? [] : {};
|
|
45
|
+
}
|
|
46
|
+
currentTarget = currentTarget[key];
|
|
47
|
+
}
|
|
48
|
+
currentTarget[selectors[selectors.length - 1]] = value;
|
|
49
|
+
return target;
|
|
50
|
+
}
|
|
51
|
+
static unset(target, path) {
|
|
52
|
+
const selectors = parsePath(path);
|
|
53
|
+
for (const [index, selector] of selectors.entries()) {
|
|
54
|
+
if (index < selectors.length - 1) {
|
|
55
|
+
target = target?.[selector];
|
|
56
|
+
if (target == null)
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
else if (Array.isArray(target)) {
|
|
60
|
+
if (Number.isNaN(Number(selector)))
|
|
61
|
+
return;
|
|
62
|
+
target.splice(Number(selector), 1);
|
|
63
|
+
}
|
|
64
|
+
else
|
|
65
|
+
delete target[selector];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
static get(value, path) {
|
|
69
|
+
const selectors = parsePath(path);
|
|
70
|
+
for (const selector of selectors)
|
|
71
|
+
value = value?.[selector];
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
static equals(a, b) {
|
|
75
|
+
function recurse(a, b, refs) {
|
|
76
|
+
if (a === b)
|
|
77
|
+
return true;
|
|
78
|
+
if (a == null || b == null)
|
|
79
|
+
return false;
|
|
80
|
+
if (typeof a !== typeof b)
|
|
81
|
+
return false;
|
|
82
|
+
if (typeof a === 'object') {
|
|
83
|
+
if (refs.has(a))
|
|
84
|
+
return refs.get(a).has(b);
|
|
85
|
+
if (!refs.has(a))
|
|
86
|
+
refs.set(a, new Set());
|
|
87
|
+
refs.get(a).add(b);
|
|
88
|
+
}
|
|
89
|
+
if (Array.isArray(a)) {
|
|
90
|
+
if (!Array.isArray(b) || a.length !== b.length)
|
|
91
|
+
return false;
|
|
92
|
+
for (let i = 0; i < a.length; i++) {
|
|
93
|
+
if (!recurse(a[i], b[i], refs))
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
if (typeof a === 'object') {
|
|
99
|
+
const keysA = Object.keys(a);
|
|
100
|
+
const keysB = Object.keys(b);
|
|
101
|
+
if (keysA.length !== keysB.length)
|
|
102
|
+
return false;
|
|
103
|
+
for (const key of keysA) {
|
|
104
|
+
if (!b.hasOwnProperty(key) || !recurse(a[key], b[key], refs))
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
return recurse(a, b, new WeakMap());
|
|
112
|
+
}
|
|
113
|
+
static clone(value) {
|
|
114
|
+
const clone = (value, map = new WeakMap()) => {
|
|
115
|
+
if (value == null)
|
|
116
|
+
return value;
|
|
117
|
+
if (typeof value !== 'object')
|
|
118
|
+
return value;
|
|
119
|
+
if (map.has(value))
|
|
120
|
+
return map.get(value);
|
|
121
|
+
let copy;
|
|
122
|
+
if (Array.isArray(value)) {
|
|
123
|
+
copy = [];
|
|
124
|
+
map.set(value, copy);
|
|
125
|
+
for (const item of value)
|
|
126
|
+
copy.push(clone(item, map));
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
copy = Object.create(Object.getPrototypeOf(value));
|
|
130
|
+
map.set(value, copy);
|
|
131
|
+
for (const key in value)
|
|
132
|
+
copy[key] = clone(value[key], map);
|
|
133
|
+
}
|
|
134
|
+
return copy;
|
|
135
|
+
};
|
|
136
|
+
return clone(value);
|
|
137
|
+
}
|
|
138
|
+
static pick(target, options) {
|
|
139
|
+
const result = options.include ? {} : { ...target };
|
|
140
|
+
if (options.include) {
|
|
141
|
+
for (const include of options.include) {
|
|
142
|
+
$Value.set(result, include, $Value.get(target, include));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (options.exclude) {
|
|
146
|
+
for (const exclude of options.exclude) {
|
|
147
|
+
$Value.unset(result, exclude);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
static orderProperties(value) {
|
|
153
|
+
const order = (value, map = new WeakMap()) => {
|
|
154
|
+
if (value == null)
|
|
155
|
+
return value;
|
|
156
|
+
if (typeof value !== 'object')
|
|
157
|
+
return value;
|
|
158
|
+
if (map.has(value))
|
|
159
|
+
return map.get(value);
|
|
160
|
+
let ordered;
|
|
161
|
+
if (Array.isArray(value)) {
|
|
162
|
+
ordered = [];
|
|
163
|
+
map.set(value, ordered);
|
|
164
|
+
for (const item of value) {
|
|
165
|
+
ordered.push(order(item, map));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const keys = Object.keys(value).sort();
|
|
170
|
+
ordered = Object.setPrototypeOf({}, Object.getPrototypeOf(value));
|
|
171
|
+
map.set(value, ordered);
|
|
172
|
+
for (const key of keys) {
|
|
173
|
+
ordered[key] = order(value[key], map);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return ordered;
|
|
177
|
+
};
|
|
178
|
+
return order(value);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Awaitable<T> = Promise<T> | T;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CamelToKebab<T extends string> = T extends `${infer a}-${infer b1}${infer b2}-${infer c1}${infer c2}-${infer d1}${infer d2}` ? `${Lowercase<a>}${Uppercase<b1>}${Lowercase<b2>}${Uppercase<c1>}${Lowercase<c2>}${Uppercase<d1>}${Lowercase<d2>}` : T extends `${infer a}-${infer b1}${infer b2}-${infer c1}${infer c2}` ? `${Lowercase<a>}${Uppercase<b1>}${Lowercase<b2>}${Uppercase<c1>}${Lowercase<c2>}` : T extends `${infer a}-${infer b1}${infer b2}` ? `${Lowercase<a>}${Uppercase<b1>}${Lowercase<b2>}` : T;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type IsUnion<T, U = T> = T extends any ? ([U] extends [T] ? false : true) : false;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type RecursivePartial<T> = {
|
|
2
|
+
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
|
|
3
|
+
};
|
|
4
|
+
export type RecursivePartialObject<T> = {
|
|
5
|
+
[P in keyof T]?: T[P] extends object ? RecursivePartial<T[P]> : T[P];
|
|
6
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Predicate<T> = (value: T) => boolean;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Selector<T = any, TResult = any> = (state: T) => TResult;
|
|
File without changes
|