@softsky/utils 2.3.0 → 2.3.1
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/objects.d.ts +3 -1
- package/dist/objects.js +10 -2
- package/package.json +1 -1
package/dist/objects.d.ts
CHANGED
|
@@ -45,10 +45,12 @@ export declare function pick<T extends object, K extends keyof T>(object: T, key
|
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
47
|
export declare class Base {
|
|
48
|
-
id: number;
|
|
49
48
|
static lastId: number;
|
|
50
49
|
static idMap: Map<number, Base>;
|
|
51
50
|
static subclasses: Map<string, Constructor<Base>>;
|
|
51
|
+
private _id;
|
|
52
|
+
get id(): number;
|
|
53
|
+
set id(value: number);
|
|
52
54
|
constructor(id?: number);
|
|
53
55
|
static registerSubclass(): void;
|
|
54
56
|
}
|
package/dist/objects.js
CHANGED
|
@@ -118,12 +118,20 @@ export function pick(object, keys) {
|
|
|
118
118
|
* ```
|
|
119
119
|
*/
|
|
120
120
|
export class Base {
|
|
121
|
-
id;
|
|
122
121
|
static lastId = 0;
|
|
123
122
|
static idMap = new Map();
|
|
124
123
|
static subclasses = new Map();
|
|
124
|
+
_id;
|
|
125
|
+
get id() {
|
|
126
|
+
return this._id;
|
|
127
|
+
}
|
|
128
|
+
set id(value) {
|
|
129
|
+
Base.idMap.delete(this._id);
|
|
130
|
+
Base.idMap.set(value, this);
|
|
131
|
+
this._id = value;
|
|
132
|
+
}
|
|
125
133
|
constructor(id = ++Base.lastId) {
|
|
126
|
-
this.
|
|
134
|
+
this._id = id;
|
|
127
135
|
Base.idMap.set(id, this);
|
|
128
136
|
}
|
|
129
137
|
static registerSubclass() {
|