@powfix/core-js 0.21.3 → 0.21.5

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.
@@ -147,7 +147,7 @@ class UUID {
147
147
  * @returns A new {@link UUID} object.
148
148
  */
149
149
  static fromHex(hex) {
150
- return new this(UUID.parseHex(hex));
150
+ return new this(this.parseHex(hex));
151
151
  }
152
152
  /**
153
153
  * Creates a UUID instance from an RFC 4122 formatted string.
@@ -155,7 +155,7 @@ class UUID {
155
155
  * @returns A new {@link UUID} object.
156
156
  */
157
157
  static fromString(str) {
158
- return new this(UUID.parseString(str));
158
+ return new this(this.parseString(str));
159
159
  }
160
160
  /**
161
161
  * Creates a UUID instance from raw bytes.
@@ -163,7 +163,7 @@ class UUID {
163
163
  * @returns A new {@link UUID} object.
164
164
  */
165
165
  static fromBytes(bytes) {
166
- return new this(UUID.parseBytes(bytes));
166
+ return new this(this.parseBytes(bytes));
167
167
  }
168
168
  /**
169
169
  * Parses any supported input (string or bytes) and returns the raw byte array.
@@ -176,10 +176,10 @@ class UUID {
176
176
  switch (length) {
177
177
  case UUID.STR_LENGTH:
178
178
  // RFC 4122 uuid(string)
179
- return UUID.parseString(input);
179
+ return this.parseString(input);
180
180
  case UUID.HEX_STR_LENGTH:
181
181
  // RFC 4122 uuid(string) without hyphens
182
- return UUID.parseHex(input);
182
+ return this.parseHex(input);
183
183
  default:
184
184
  throw new Error(`Invalid input string, length should be ${UUID.STR_LENGTH} or ${UUID.HEX_STR_LENGTH}`);
185
185
  }
@@ -188,7 +188,7 @@ class UUID {
188
188
  return input.toBytes();
189
189
  }
190
190
  else if (ArrayBuffer.isView(input)) {
191
- return UUID.parseBytes(input);
191
+ return this.parseBytes(input);
192
192
  }
193
193
  else {
194
194
  throw new Error("Invalid input, Expected string or ArrayBufferView");
@@ -144,7 +144,7 @@ export class UUID {
144
144
  * @returns A new {@link UUID} object.
145
145
  */
146
146
  static fromHex(hex) {
147
- return new this(UUID.parseHex(hex));
147
+ return new this(this.parseHex(hex));
148
148
  }
149
149
  /**
150
150
  * Creates a UUID instance from an RFC 4122 formatted string.
@@ -152,7 +152,7 @@ export class UUID {
152
152
  * @returns A new {@link UUID} object.
153
153
  */
154
154
  static fromString(str) {
155
- return new this(UUID.parseString(str));
155
+ return new this(this.parseString(str));
156
156
  }
157
157
  /**
158
158
  * Creates a UUID instance from raw bytes.
@@ -160,7 +160,7 @@ export class UUID {
160
160
  * @returns A new {@link UUID} object.
161
161
  */
162
162
  static fromBytes(bytes) {
163
- return new this(UUID.parseBytes(bytes));
163
+ return new this(this.parseBytes(bytes));
164
164
  }
165
165
  /**
166
166
  * Parses any supported input (string or bytes) and returns the raw byte array.
@@ -173,10 +173,10 @@ export class UUID {
173
173
  switch (length) {
174
174
  case UUID.STR_LENGTH:
175
175
  // RFC 4122 uuid(string)
176
- return UUID.parseString(input);
176
+ return this.parseString(input);
177
177
  case UUID.HEX_STR_LENGTH:
178
178
  // RFC 4122 uuid(string) without hyphens
179
- return UUID.parseHex(input);
179
+ return this.parseHex(input);
180
180
  default:
181
181
  throw new Error(`Invalid input string, length should be ${UUID.STR_LENGTH} or ${UUID.HEX_STR_LENGTH}`);
182
182
  }
@@ -185,7 +185,7 @@ export class UUID {
185
185
  return input.toBytes();
186
186
  }
187
187
  else if (ArrayBuffer.isView(input)) {
188
- return UUID.parseBytes(input);
188
+ return this.parseBytes(input);
189
189
  }
190
190
  else {
191
191
  throw new Error("Invalid input, Expected string or ArrayBufferView");
@@ -71,19 +71,19 @@ export declare class UUID {
71
71
  * @param hex - The hex representation of the UUID.
72
72
  * @returns A new {@link UUID} object.
73
73
  */
74
- static fromHex<T extends typeof UUID>(hex: string): InstanceType<T>;
74
+ static fromHex<T extends typeof UUID>(this: T, hex: string): InstanceType<T>;
75
75
  /**
76
76
  * Creates a UUID instance from an RFC 4122 formatted string.
77
77
  * @param str - The UUID string with hyphens.
78
78
  * @returns A new {@link UUID} object.
79
79
  */
80
- static fromString<T extends typeof UUID>(str: string): InstanceType<T>;
80
+ static fromString<T extends typeof UUID>(this: T, str: string): InstanceType<T>;
81
81
  /**
82
82
  * Creates a UUID instance from raw bytes.
83
83
  * @param bytes - An ArrayBufferView containing 16 bytes.
84
84
  * @returns A new {@link UUID} object.
85
85
  */
86
- static fromBytes<T extends typeof UUID>(bytes: ArrayBufferView): InstanceType<T>;
86
+ static fromBytes<T extends typeof UUID>(this: T, bytes: ArrayBufferView): InstanceType<T>;
87
87
  /**
88
88
  * Parses any supported input (string or bytes) and returns the raw byte array.
89
89
  * @param input - The value to parse.
@@ -95,7 +95,7 @@ export declare class UUID {
95
95
  * @param input - The value to parse.
96
96
  * @returns A new {@link UUID} object.
97
97
  */
98
- static from<T extends typeof UUID>(this: T, input: UuidInput | InstanceType<T>): InstanceType<T>;
98
+ static from<T extends typeof UUID>(this: T, input: UuidInput): InstanceType<T>;
99
99
  /** Returns the nil (all zero) UUID. */
100
100
  static nil<T extends typeof UUID>(this: T): InstanceType<T>;
101
101
  /** Returns a UUID consisting of all 0xFF bytes. */
@@ -115,8 +115,8 @@ export declare class UUID {
115
115
  static compare(uuid1: UuidInput, uuid2: UuidInput): number;
116
116
  /** Raw byte representation of the UUID. */
117
117
  readonly bytes: Uint8Array;
118
- private _str?;
119
- private _hex?;
118
+ protected _str?: string;
119
+ protected _hex?: string;
120
120
  /**
121
121
  * Constructs a new {@link UUID} instance from any supported input type.
122
122
  * @param input - The value to parse (string or ArrayBufferView).
@@ -147,7 +147,7 @@ class UUID {
147
147
  * @returns A new {@link UUID} object.
148
148
  */
149
149
  static fromHex(hex) {
150
- return new this(UUID.parseHex(hex));
150
+ return new this(this.parseHex(hex));
151
151
  }
152
152
  /**
153
153
  * Creates a UUID instance from an RFC 4122 formatted string.
@@ -155,7 +155,7 @@ class UUID {
155
155
  * @returns A new {@link UUID} object.
156
156
  */
157
157
  static fromString(str) {
158
- return new this(UUID.parseString(str));
158
+ return new this(this.parseString(str));
159
159
  }
160
160
  /**
161
161
  * Creates a UUID instance from raw bytes.
@@ -163,7 +163,7 @@ class UUID {
163
163
  * @returns A new {@link UUID} object.
164
164
  */
165
165
  static fromBytes(bytes) {
166
- return new this(UUID.parseBytes(bytes));
166
+ return new this(this.parseBytes(bytes));
167
167
  }
168
168
  /**
169
169
  * Parses any supported input (string or bytes) and returns the raw byte array.
@@ -176,10 +176,10 @@ class UUID {
176
176
  switch (length) {
177
177
  case UUID.STR_LENGTH:
178
178
  // RFC 4122 uuid(string)
179
- return UUID.parseString(input);
179
+ return this.parseString(input);
180
180
  case UUID.HEX_STR_LENGTH:
181
181
  // RFC 4122 uuid(string) without hyphens
182
- return UUID.parseHex(input);
182
+ return this.parseHex(input);
183
183
  default:
184
184
  throw new Error(`Invalid input string, length should be ${UUID.STR_LENGTH} or ${UUID.HEX_STR_LENGTH}`);
185
185
  }
@@ -188,7 +188,7 @@ class UUID {
188
188
  return input.toBytes();
189
189
  }
190
190
  else if (ArrayBuffer.isView(input)) {
191
- return UUID.parseBytes(input);
191
+ return this.parseBytes(input);
192
192
  }
193
193
  else {
194
194
  throw new Error("Invalid input, Expected string or ArrayBufferView");
@@ -144,7 +144,7 @@ export class UUID {
144
144
  * @returns A new {@link UUID} object.
145
145
  */
146
146
  static fromHex(hex) {
147
- return new this(UUID.parseHex(hex));
147
+ return new this(this.parseHex(hex));
148
148
  }
149
149
  /**
150
150
  * Creates a UUID instance from an RFC 4122 formatted string.
@@ -152,7 +152,7 @@ export class UUID {
152
152
  * @returns A new {@link UUID} object.
153
153
  */
154
154
  static fromString(str) {
155
- return new this(UUID.parseString(str));
155
+ return new this(this.parseString(str));
156
156
  }
157
157
  /**
158
158
  * Creates a UUID instance from raw bytes.
@@ -160,7 +160,7 @@ export class UUID {
160
160
  * @returns A new {@link UUID} object.
161
161
  */
162
162
  static fromBytes(bytes) {
163
- return new this(UUID.parseBytes(bytes));
163
+ return new this(this.parseBytes(bytes));
164
164
  }
165
165
  /**
166
166
  * Parses any supported input (string or bytes) and returns the raw byte array.
@@ -173,10 +173,10 @@ export class UUID {
173
173
  switch (length) {
174
174
  case UUID.STR_LENGTH:
175
175
  // RFC 4122 uuid(string)
176
- return UUID.parseString(input);
176
+ return this.parseString(input);
177
177
  case UUID.HEX_STR_LENGTH:
178
178
  // RFC 4122 uuid(string) without hyphens
179
- return UUID.parseHex(input);
179
+ return this.parseHex(input);
180
180
  default:
181
181
  throw new Error(`Invalid input string, length should be ${UUID.STR_LENGTH} or ${UUID.HEX_STR_LENGTH}`);
182
182
  }
@@ -185,7 +185,7 @@ export class UUID {
185
185
  return input.toBytes();
186
186
  }
187
187
  else if (ArrayBuffer.isView(input)) {
188
- return UUID.parseBytes(input);
188
+ return this.parseBytes(input);
189
189
  }
190
190
  else {
191
191
  throw new Error("Invalid input, Expected string or ArrayBufferView");
@@ -147,7 +147,7 @@ class UUID {
147
147
  * @returns A new {@link UUID} object.
148
148
  */
149
149
  static fromHex(hex) {
150
- return new this(UUID.parseHex(hex));
150
+ return new this(this.parseHex(hex));
151
151
  }
152
152
  /**
153
153
  * Creates a UUID instance from an RFC 4122 formatted string.
@@ -155,7 +155,7 @@ class UUID {
155
155
  * @returns A new {@link UUID} object.
156
156
  */
157
157
  static fromString(str) {
158
- return new this(UUID.parseString(str));
158
+ return new this(this.parseString(str));
159
159
  }
160
160
  /**
161
161
  * Creates a UUID instance from raw bytes.
@@ -163,7 +163,7 @@ class UUID {
163
163
  * @returns A new {@link UUID} object.
164
164
  */
165
165
  static fromBytes(bytes) {
166
- return new this(UUID.parseBytes(bytes));
166
+ return new this(this.parseBytes(bytes));
167
167
  }
168
168
  /**
169
169
  * Parses any supported input (string or bytes) and returns the raw byte array.
@@ -176,10 +176,10 @@ class UUID {
176
176
  switch (length) {
177
177
  case UUID.STR_LENGTH:
178
178
  // RFC 4122 uuid(string)
179
- return UUID.parseString(input);
179
+ return this.parseString(input);
180
180
  case UUID.HEX_STR_LENGTH:
181
181
  // RFC 4122 uuid(string) without hyphens
182
- return UUID.parseHex(input);
182
+ return this.parseHex(input);
183
183
  default:
184
184
  throw new Error(`Invalid input string, length should be ${UUID.STR_LENGTH} or ${UUID.HEX_STR_LENGTH}`);
185
185
  }
@@ -188,7 +188,7 @@ class UUID {
188
188
  return input.toBytes();
189
189
  }
190
190
  else if (ArrayBuffer.isView(input)) {
191
- return UUID.parseBytes(input);
191
+ return this.parseBytes(input);
192
192
  }
193
193
  else {
194
194
  throw new Error("Invalid input, Expected string or ArrayBufferView");
@@ -144,7 +144,7 @@ export class UUID {
144
144
  * @returns A new {@link UUID} object.
145
145
  */
146
146
  static fromHex(hex) {
147
- return new this(UUID.parseHex(hex));
147
+ return new this(this.parseHex(hex));
148
148
  }
149
149
  /**
150
150
  * Creates a UUID instance from an RFC 4122 formatted string.
@@ -152,7 +152,7 @@ export class UUID {
152
152
  * @returns A new {@link UUID} object.
153
153
  */
154
154
  static fromString(str) {
155
- return new this(UUID.parseString(str));
155
+ return new this(this.parseString(str));
156
156
  }
157
157
  /**
158
158
  * Creates a UUID instance from raw bytes.
@@ -160,7 +160,7 @@ export class UUID {
160
160
  * @returns A new {@link UUID} object.
161
161
  */
162
162
  static fromBytes(bytes) {
163
- return new this(UUID.parseBytes(bytes));
163
+ return new this(this.parseBytes(bytes));
164
164
  }
165
165
  /**
166
166
  * Parses any supported input (string or bytes) and returns the raw byte array.
@@ -173,10 +173,10 @@ export class UUID {
173
173
  switch (length) {
174
174
  case UUID.STR_LENGTH:
175
175
  // RFC 4122 uuid(string)
176
- return UUID.parseString(input);
176
+ return this.parseString(input);
177
177
  case UUID.HEX_STR_LENGTH:
178
178
  // RFC 4122 uuid(string) without hyphens
179
- return UUID.parseHex(input);
179
+ return this.parseHex(input);
180
180
  default:
181
181
  throw new Error(`Invalid input string, length should be ${UUID.STR_LENGTH} or ${UUID.HEX_STR_LENGTH}`);
182
182
  }
@@ -185,7 +185,7 @@ export class UUID {
185
185
  return input.toBytes();
186
186
  }
187
187
  else if (ArrayBuffer.isView(input)) {
188
- return UUID.parseBytes(input);
188
+ return this.parseBytes(input);
189
189
  }
190
190
  else {
191
191
  throw new Error("Invalid input, Expected string or ArrayBufferView");
@@ -71,19 +71,19 @@ export declare class UUID {
71
71
  * @param hex - The hex representation of the UUID.
72
72
  * @returns A new {@link UUID} object.
73
73
  */
74
- static fromHex<T extends typeof UUID>(hex: string): InstanceType<T>;
74
+ static fromHex<T extends typeof UUID>(this: T, hex: string): InstanceType<T>;
75
75
  /**
76
76
  * Creates a UUID instance from an RFC 4122 formatted string.
77
77
  * @param str - The UUID string with hyphens.
78
78
  * @returns A new {@link UUID} object.
79
79
  */
80
- static fromString<T extends typeof UUID>(str: string): InstanceType<T>;
80
+ static fromString<T extends typeof UUID>(this: T, str: string): InstanceType<T>;
81
81
  /**
82
82
  * Creates a UUID instance from raw bytes.
83
83
  * @param bytes - An ArrayBufferView containing 16 bytes.
84
84
  * @returns A new {@link UUID} object.
85
85
  */
86
- static fromBytes<T extends typeof UUID>(bytes: ArrayBufferView): InstanceType<T>;
86
+ static fromBytes<T extends typeof UUID>(this: T, bytes: ArrayBufferView): InstanceType<T>;
87
87
  /**
88
88
  * Parses any supported input (string or bytes) and returns the raw byte array.
89
89
  * @param input - The value to parse.
@@ -95,7 +95,7 @@ export declare class UUID {
95
95
  * @param input - The value to parse.
96
96
  * @returns A new {@link UUID} object.
97
97
  */
98
- static from<T extends typeof UUID>(this: T, input: UuidInput | InstanceType<T>): InstanceType<T>;
98
+ static from<T extends typeof UUID>(this: T, input: UuidInput): InstanceType<T>;
99
99
  /** Returns the nil (all zero) UUID. */
100
100
  static nil<T extends typeof UUID>(this: T): InstanceType<T>;
101
101
  /** Returns a UUID consisting of all 0xFF bytes. */
@@ -115,8 +115,8 @@ export declare class UUID {
115
115
  static compare(uuid1: UuidInput, uuid2: UuidInput): number;
116
116
  /** Raw byte representation of the UUID. */
117
117
  readonly bytes: Uint8Array;
118
- private _str?;
119
- private _hex?;
118
+ protected _str?: string;
119
+ protected _hex?: string;
120
120
  /**
121
121
  * Constructs a new {@link UUID} instance from any supported input type.
122
122
  * @param input - The value to parse (string or ArrayBufferView).
@@ -71,19 +71,19 @@ export declare class UUID {
71
71
  * @param hex - The hex representation of the UUID.
72
72
  * @returns A new {@link UUID} object.
73
73
  */
74
- static fromHex<T extends typeof UUID>(hex: string): InstanceType<T>;
74
+ static fromHex<T extends typeof UUID>(this: T, hex: string): InstanceType<T>;
75
75
  /**
76
76
  * Creates a UUID instance from an RFC 4122 formatted string.
77
77
  * @param str - The UUID string with hyphens.
78
78
  * @returns A new {@link UUID} object.
79
79
  */
80
- static fromString<T extends typeof UUID>(str: string): InstanceType<T>;
80
+ static fromString<T extends typeof UUID>(this: T, str: string): InstanceType<T>;
81
81
  /**
82
82
  * Creates a UUID instance from raw bytes.
83
83
  * @param bytes - An ArrayBufferView containing 16 bytes.
84
84
  * @returns A new {@link UUID} object.
85
85
  */
86
- static fromBytes<T extends typeof UUID>(bytes: ArrayBufferView): InstanceType<T>;
86
+ static fromBytes<T extends typeof UUID>(this: T, bytes: ArrayBufferView): InstanceType<T>;
87
87
  /**
88
88
  * Parses any supported input (string or bytes) and returns the raw byte array.
89
89
  * @param input - The value to parse.
@@ -95,7 +95,7 @@ export declare class UUID {
95
95
  * @param input - The value to parse.
96
96
  * @returns A new {@link UUID} object.
97
97
  */
98
- static from<T extends typeof UUID>(this: T, input: UuidInput | InstanceType<T>): InstanceType<T>;
98
+ static from<T extends typeof UUID>(this: T, input: UuidInput): InstanceType<T>;
99
99
  /** Returns the nil (all zero) UUID. */
100
100
  static nil<T extends typeof UUID>(this: T): InstanceType<T>;
101
101
  /** Returns a UUID consisting of all 0xFF bytes. */
@@ -115,8 +115,8 @@ export declare class UUID {
115
115
  static compare(uuid1: UuidInput, uuid2: UuidInput): number;
116
116
  /** Raw byte representation of the UUID. */
117
117
  readonly bytes: Uint8Array;
118
- private _str?;
119
- private _hex?;
118
+ protected _str?: string;
119
+ protected _hex?: string;
120
120
  /**
121
121
  * Constructs a new {@link UUID} instance from any supported input type.
122
122
  * @param input - The value to parse (string or ArrayBufferView).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powfix/core-js",
3
- "version": "0.21.3",
3
+ "version": "0.21.5",
4
4
  "description": "core package",
5
5
  "author": "Kwon Kyung-Min <powfix@gmail.com>",
6
6
  "private": false,