utilium 0.5.6 → 0.5.8
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/list.d.ts +0 -1
- package/dist/objects.d.ts +1 -0
- package/dist/objects.js +3 -0
- package/dist/struct.d.ts +5 -86
- package/package.json +7 -7
- package/src/objects.ts +4 -0
package/dist/list.d.ts
CHANGED
package/dist/objects.d.ts
CHANGED
@@ -13,3 +13,4 @@ export type Entries<T extends object> = UnionToTuple<{
|
|
13
13
|
}[keyof T]>;
|
14
14
|
export declare function isJSON(str: string): boolean;
|
15
15
|
export declare function resolveConstructors(object: object): string[];
|
16
|
+
export declare function map<const T extends Partial<Record<any, any>>>(items: T): Map<keyof T, T[keyof T]>;
|
package/dist/objects.js
CHANGED
package/dist/struct.d.ts
CHANGED
@@ -30,94 +30,13 @@ export declare function deserialize(instance: unknown, _buffer: ArrayBuffer | Ar
|
|
30
30
|
* Also can be a name when legacy decorators are used
|
31
31
|
*/
|
32
32
|
type Context = string | symbol | ClassMemberDecoratorContext;
|
33
|
+
declare function _member<T extends primitive.Valid>(type: T): {
|
34
|
+
(length: number): (target: object, context?: Context) => void;
|
35
|
+
(target: object, context?: Context): void;
|
36
|
+
};
|
33
37
|
/**
|
34
38
|
* Shortcut types
|
35
39
|
*
|
36
40
|
* Instead of writing `@member(type)` you can write `@types.type`, or `@types.type(length)` for arrays
|
37
41
|
*/
|
38
|
-
export declare const types: {
|
39
|
-
int8: {
|
40
|
-
(length: number): (target: object, context?: Context) => void;
|
41
|
-
(target: object, context?: Context): void;
|
42
|
-
};
|
43
|
-
int16: {
|
44
|
-
(length: number): (target: object, context?: Context) => void;
|
45
|
-
(target: object, context?: Context): void;
|
46
|
-
};
|
47
|
-
int32: {
|
48
|
-
(length: number): (target: object, context?: Context) => void;
|
49
|
-
(target: object, context?: Context): void;
|
50
|
-
};
|
51
|
-
int64: {
|
52
|
-
(length: number): (target: object, context?: Context) => void;
|
53
|
-
(target: object, context?: Context): void;
|
54
|
-
};
|
55
|
-
uint8: {
|
56
|
-
(length: number): (target: object, context?: Context) => void;
|
57
|
-
(target: object, context?: Context): void;
|
58
|
-
};
|
59
|
-
uint16: {
|
60
|
-
(length: number): (target: object, context?: Context) => void;
|
61
|
-
(target: object, context?: Context): void;
|
62
|
-
};
|
63
|
-
uint32: {
|
64
|
-
(length: number): (target: object, context?: Context) => void;
|
65
|
-
(target: object, context?: Context): void;
|
66
|
-
};
|
67
|
-
uint64: {
|
68
|
-
(length: number): (target: object, context?: Context) => void;
|
69
|
-
(target: object, context?: Context): void;
|
70
|
-
};
|
71
|
-
float32: {
|
72
|
-
(length: number): (target: object, context?: Context) => void;
|
73
|
-
(target: object, context?: Context): void;
|
74
|
-
};
|
75
|
-
float64: {
|
76
|
-
(length: number): (target: object, context?: Context) => void;
|
77
|
-
(target: object, context?: Context): void;
|
78
|
-
};
|
79
|
-
Int8: {
|
80
|
-
(length: number): (target: object, context?: Context) => void;
|
81
|
-
(target: object, context?: Context): void;
|
82
|
-
};
|
83
|
-
Int16: {
|
84
|
-
(length: number): (target: object, context?: Context) => void;
|
85
|
-
(target: object, context?: Context): void;
|
86
|
-
};
|
87
|
-
Int32: {
|
88
|
-
(length: number): (target: object, context?: Context) => void;
|
89
|
-
(target: object, context?: Context): void;
|
90
|
-
};
|
91
|
-
Int64: {
|
92
|
-
(length: number): (target: object, context?: Context) => void;
|
93
|
-
(target: object, context?: Context): void;
|
94
|
-
};
|
95
|
-
Uint8: {
|
96
|
-
(length: number): (target: object, context?: Context) => void;
|
97
|
-
(target: object, context?: Context): void;
|
98
|
-
};
|
99
|
-
Uint16: {
|
100
|
-
(length: number): (target: object, context?: Context) => void;
|
101
|
-
(target: object, context?: Context): void;
|
102
|
-
};
|
103
|
-
Uint32: {
|
104
|
-
(length: number): (target: object, context?: Context) => void;
|
105
|
-
(target: object, context?: Context): void;
|
106
|
-
};
|
107
|
-
Uint64: {
|
108
|
-
(length: number): (target: object, context?: Context) => void;
|
109
|
-
(target: object, context?: Context): void;
|
110
|
-
};
|
111
|
-
Float32: {
|
112
|
-
(length: number): (target: object, context?: Context) => void;
|
113
|
-
(target: object, context?: Context): void;
|
114
|
-
};
|
115
|
-
Float64: {
|
116
|
-
(length: number): (target: object, context?: Context) => void;
|
117
|
-
(target: object, context?: Context): void;
|
118
|
-
};
|
119
|
-
char: {
|
120
|
-
(length: number): (target: object, context?: Context) => void;
|
121
|
-
(target: object, context?: Context): void;
|
122
|
-
};
|
123
|
-
};
|
42
|
+
export declare const types: { [K in primitive.Valid]: ReturnType<typeof _member<K>>; };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "utilium",
|
3
|
-
"version": "0.5.
|
3
|
+
"version": "0.5.8",
|
4
4
|
"description": "Typescript utilies",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -19,22 +19,22 @@
|
|
19
19
|
},
|
20
20
|
"repository": {
|
21
21
|
"type": "git",
|
22
|
-
"url": "git+https://github.com/
|
22
|
+
"url": "git+https://github.com/james-pre/utilium.git"
|
23
23
|
},
|
24
|
-
"author": "James
|
24
|
+
"author": "James Prevett <jp@jamespre.dev> (https://jamespre.dev)",
|
25
25
|
"license": "MIT",
|
26
26
|
"bugs": {
|
27
|
-
"url": "https://github.com/
|
27
|
+
"url": "https://github.com/james-pre/utilium/issues"
|
28
28
|
},
|
29
|
-
"homepage": "https://github.com/
|
29
|
+
"homepage": "https://github.com/james-pre/utilium#readme",
|
30
30
|
"devDependencies": {
|
31
31
|
"@types/node": "^20.12.7",
|
32
32
|
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
33
33
|
"@typescript-eslint/parser": "^6.2.0",
|
34
34
|
"eslint": "^8.45.0",
|
35
35
|
"prettier": "^3.2.5",
|
36
|
-
"typedoc": "^0.
|
37
|
-
"typescript": "^5.
|
36
|
+
"typedoc": "^0.26.6",
|
37
|
+
"typescript": "^5.5.4"
|
38
38
|
},
|
39
39
|
"dependencies": {
|
40
40
|
"eventemitter3": "^5.0.1"
|
package/src/objects.ts
CHANGED
@@ -55,3 +55,7 @@ export function resolveConstructors(object: object): string[] {
|
|
55
55
|
}
|
56
56
|
return constructors;
|
57
57
|
}
|
58
|
+
|
59
|
+
export function map<const T extends Partial<Record<any, any>>>(items: T): Map<keyof T, T[keyof T]> {
|
60
|
+
return new Map(Object.entries(items) as [keyof T, T[keyof T]][]);
|
61
|
+
}
|