@fluid-experimental/property-common 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229

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.
Files changed (127) hide show
  1. package/.eslintrc.js +9 -11
  2. package/.mocharc.json +6 -6
  3. package/README.md +1 -0
  4. package/api-extractor.json +2 -2
  5. package/dist/chronometer.d.ts.map +1 -1
  6. package/dist/chronometer.js.map +1 -1
  7. package/dist/consoleUtils.d.ts.map +1 -1
  8. package/dist/consoleUtils.js +4 -1
  9. package/dist/consoleUtils.js.map +1 -1
  10. package/dist/constants.d.ts +6 -6
  11. package/dist/constants.d.ts.map +1 -1
  12. package/dist/constants.js +16 -26
  13. package/dist/constants.js.map +1 -1
  14. package/dist/datastructures/collection.d.ts.map +1 -1
  15. package/dist/datastructures/collection.js +5 -4
  16. package/dist/datastructures/collection.js.map +1 -1
  17. package/dist/datastructures/dataArray.d.ts.map +1 -1
  18. package/dist/datastructures/dataArray.js +18 -9
  19. package/dist/datastructures/dataArray.js.map +1 -1
  20. package/dist/datastructures/integer64.d.ts.map +1 -1
  21. package/dist/datastructures/integer64.js +1 -1
  22. package/dist/datastructures/integer64.js.map +1 -1
  23. package/dist/datastructures/sortedCollection.d.ts.map +1 -1
  24. package/dist/datastructures/sortedCollection.js +3 -1
  25. package/dist/datastructures/sortedCollection.js.map +1 -1
  26. package/dist/deferredPromise.d.ts +1 -1
  27. package/dist/deferredPromise.d.ts.map +1 -1
  28. package/dist/deferredPromise.js +9 -3
  29. package/dist/deferredPromise.js.map +1 -1
  30. package/dist/deterministicRandomGenerator.d.ts.map +1 -1
  31. package/dist/deterministicRandomGenerator.js +6 -6
  32. package/dist/deterministicRandomGenerator.js.map +1 -1
  33. package/dist/error_objects/flaggedError.d.ts.map +1 -1
  34. package/dist/error_objects/flaggedError.js.map +1 -1
  35. package/dist/error_objects/httpError.d.ts.map +1 -1
  36. package/dist/error_objects/httpError.js +9 -9
  37. package/dist/error_objects/httpError.js.map +1 -1
  38. package/dist/error_objects/httpErrorNoStack.d.ts.map +1 -1
  39. package/dist/error_objects/httpErrorNoStack.js.map +1 -1
  40. package/dist/error_objects/operationError.d.ts +7 -7
  41. package/dist/error_objects/operationError.d.ts.map +1 -1
  42. package/dist/error_objects/operationError.js +7 -7
  43. package/dist/error_objects/operationError.js.map +1 -1
  44. package/dist/guidUtils.d.ts.map +1 -1
  45. package/dist/guidUtils.js +10 -9
  46. package/dist/guidUtils.js.map +1 -1
  47. package/dist/hashCalculator.d.ts.map +1 -1
  48. package/dist/hashCalculator.js.map +1 -1
  49. package/dist/joinPaths.d.ts.map +1 -1
  50. package/dist/joinPaths.js.map +1 -1
  51. package/dist/packageVersion.d.ts +1 -1
  52. package/dist/packageVersion.js +1 -1
  53. package/dist/packageVersion.js.map +1 -1
  54. package/lib/chronometer.d.ts.map +1 -1
  55. package/lib/chronometer.js.map +1 -1
  56. package/lib/consoleUtils.d.ts.map +1 -1
  57. package/lib/consoleUtils.js +4 -1
  58. package/lib/consoleUtils.js.map +1 -1
  59. package/lib/constants.d.ts +6 -6
  60. package/lib/constants.d.ts.map +1 -1
  61. package/lib/constants.js +16 -26
  62. package/lib/constants.js.map +1 -1
  63. package/lib/datastructures/collection.d.ts.map +1 -1
  64. package/lib/datastructures/collection.js +5 -4
  65. package/lib/datastructures/collection.js.map +1 -1
  66. package/lib/datastructures/dataArray.d.ts.map +1 -1
  67. package/lib/datastructures/dataArray.js +18 -9
  68. package/lib/datastructures/dataArray.js.map +1 -1
  69. package/lib/datastructures/integer64.d.ts.map +1 -1
  70. package/lib/datastructures/integer64.js +1 -1
  71. package/lib/datastructures/integer64.js.map +1 -1
  72. package/lib/datastructures/sortedCollection.d.ts.map +1 -1
  73. package/lib/datastructures/sortedCollection.js +3 -1
  74. package/lib/datastructures/sortedCollection.js.map +1 -1
  75. package/lib/deferredPromise.d.ts +1 -1
  76. package/lib/deferredPromise.d.ts.map +1 -1
  77. package/lib/deferredPromise.js +9 -3
  78. package/lib/deferredPromise.js.map +1 -1
  79. package/lib/deterministicRandomGenerator.d.ts.map +1 -1
  80. package/lib/deterministicRandomGenerator.js +6 -6
  81. package/lib/deterministicRandomGenerator.js.map +1 -1
  82. package/lib/error_objects/flaggedError.d.ts.map +1 -1
  83. package/lib/error_objects/flaggedError.js.map +1 -1
  84. package/lib/error_objects/httpError.d.ts.map +1 -1
  85. package/lib/error_objects/httpError.js +9 -9
  86. package/lib/error_objects/httpError.js.map +1 -1
  87. package/lib/error_objects/httpErrorNoStack.d.ts.map +1 -1
  88. package/lib/error_objects/httpErrorNoStack.js.map +1 -1
  89. package/lib/error_objects/operationError.d.ts +7 -7
  90. package/lib/error_objects/operationError.d.ts.map +1 -1
  91. package/lib/error_objects/operationError.js +7 -7
  92. package/lib/error_objects/operationError.js.map +1 -1
  93. package/lib/guidUtils.d.ts.map +1 -1
  94. package/lib/guidUtils.js +10 -9
  95. package/lib/guidUtils.js.map +1 -1
  96. package/lib/hashCalculator.d.ts.map +1 -1
  97. package/lib/hashCalculator.js.map +1 -1
  98. package/lib/joinPaths.d.ts.map +1 -1
  99. package/lib/joinPaths.js.map +1 -1
  100. package/lib/packageVersion.d.ts +1 -1
  101. package/lib/packageVersion.js +1 -1
  102. package/lib/packageVersion.js.map +1 -1
  103. package/package.json +42 -40
  104. package/platform-dependent/README.md +1 -0
  105. package/platform-dependent/browser.js +5 -5
  106. package/platform-dependent/package.json +14 -14
  107. package/platform-dependent/server.js +5 -5
  108. package/prettier.config.cjs +1 -1
  109. package/src/chronometer.ts +174 -169
  110. package/src/consoleUtils.ts +16 -11
  111. package/src/constants.ts +1683 -1640
  112. package/src/datastructures/collection.ts +417 -416
  113. package/src/datastructures/dataArray.ts +516 -492
  114. package/src/datastructures/integer64.ts +102 -99
  115. package/src/datastructures/sortedCollection.ts +155 -145
  116. package/src/deferredPromise.ts +43 -42
  117. package/src/deterministicRandomGenerator.ts +59 -59
  118. package/src/error_objects/flaggedError.ts +29 -29
  119. package/src/error_objects/httpError.ts +45 -42
  120. package/src/error_objects/httpErrorNoStack.ts +17 -17
  121. package/src/error_objects/operationError.ts +62 -62
  122. package/src/guidUtils.ts +182 -171
  123. package/src/hashCalculator.ts +5 -2
  124. package/src/joinPaths.ts +15 -9
  125. package/src/packageVersion.ts +1 -1
  126. package/tsconfig.esnext.json +6 -6
  127. package/tsconfig.json +9 -13
@@ -1,16 +1,16 @@
1
1
  {
2
- "name": "@fluid-internal/platform-dependent",
3
- "version": "2.0.0-dev.2.3.0.115467",
4
- "private": true,
5
- "description": "Helper package that separates code for browser and server.",
6
- "homepage": "https://fluidframework.com",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/microsoft/FluidFramework.git",
10
- "directory": "experimental/PropertyDDS/packages/property-common/platform-dependent"
11
- },
12
- "license": "MIT",
13
- "author": "Microsoft and contributors",
14
- "main": "server.js",
15
- "browser": "browser.js"
2
+ "name": "@fluid-internal/platform-dependent",
3
+ "version": "2.0.0-dev.4.1.0.148229",
4
+ "private": true,
5
+ "description": "Helper package that separates code for browser and server.",
6
+ "homepage": "https://fluidframework.com",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/microsoft/FluidFramework.git",
10
+ "directory": "experimental/PropertyDDS/packages/property-common/platform-dependent"
11
+ },
12
+ "license": "MIT",
13
+ "author": "Microsoft and contributors",
14
+ "main": "server.js",
15
+ "browser": "browser.js"
16
16
  }
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- const crypto = require('crypto');
5
+ const crypto = require("crypto");
6
6
  /**
7
7
  * Create an array with random uint32 values
8
8
  *
@@ -10,11 +10,11 @@ const crypto = require('crypto');
10
10
  * @return {number[]} - an array with random values
11
11
  */
12
12
  function generateRandomUInt32Array(length) {
13
- const buffer = Buffer.alloc(length * 4);
14
- crypto.randomFillSync(buffer);
15
- return Array.from({ length }, (_, i) => buffer.readUIntBE(i * 4, 4));
13
+ const buffer = Buffer.alloc(length * 4);
14
+ crypto.randomFillSync(buffer);
15
+ return Array.from({ length }, (_, i) => buffer.readUIntBE(i * 4, 4));
16
16
  }
17
17
 
18
18
  module.exports = {
19
- generateRandomUInt32Array
19
+ generateRandomUInt32Array,
20
20
  };
@@ -4,5 +4,5 @@
4
4
  */
5
5
 
6
6
  module.exports = {
7
- ...require("@fluidframework/build-common/prettier.config.cjs"),
7
+ ...require("@fluidframework/build-common/prettier.config.cjs"),
8
8
  };
@@ -14,195 +14,200 @@ declare let process: any;
14
14
  * All the chronometer implementations (hrtime, window.performance, and date:
15
15
  */
16
16
  const implementations = {
17
- // Node implementation uses hrtime
18
- node: {
19
- name: "hrtime",
20
- _startTime: 0,
21
- _stopTime: undefined as any[] | undefined,
22
- stop: () => { },
17
+ // Node implementation uses hrtime
18
+ node: {
19
+ name: "hrtime",
20
+ _startTime: 0,
21
+ _stopTime: undefined as any[] | undefined,
22
+ stop: () => {},
23
23
 
24
- _start() {
25
- this._startTime = process.hrtime();
26
- },
27
- _stop() {
28
- this._stopTime = process.hrtime(this._startTime);
29
- },
30
- _elapsedSec(): number {
31
- if (this._stopTime === undefined) {
32
- this.stop();
33
- }
34
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
35
- return (this._stopTime![0] as number) + (this._stopTime![1] as number) / 1000000000;
36
- },
37
- _elapsedMilliSec(): number {
38
- if (this._stopTime === undefined) {
39
- this.stop();
40
- }
41
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
42
- return this._stopTime![0] * 1000 + this._stopTime![1] / 1000000;
43
- },
44
- _elapsedMicroSec(): number {
45
- if (this._stopTime === undefined) {
46
- this.stop();
47
- }
48
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
49
- return this._stopTime![0] * 1000000 + this._stopTime![1] / 1000;
50
- },
51
- },
52
- // Browser implementation uses window.performance (if available):
53
- performance: {
54
- name: "window.performance",
55
- _startTime: 0,
56
- _stopTime: 0,
24
+ _start() {
25
+ this._startTime = process.hrtime();
26
+ },
27
+ _stop() {
28
+ this._stopTime = process.hrtime(this._startTime);
29
+ },
30
+ _elapsedSec(): number {
31
+ if (this._stopTime === undefined) {
32
+ this.stop();
33
+ }
34
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
35
+ return (this._stopTime![0] as number) + (this._stopTime![1] as number) / 1000000000;
36
+ },
37
+ _elapsedMilliSec(): number {
38
+ if (this._stopTime === undefined) {
39
+ this.stop();
40
+ }
41
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
42
+ return this._stopTime![0] * 1000 + this._stopTime![1] / 1000000;
43
+ },
44
+ _elapsedMicroSec(): number {
45
+ if (this._stopTime === undefined) {
46
+ this.stop();
47
+ }
48
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
49
+ return this._stopTime![0] * 1000000 + this._stopTime![1] / 1000;
50
+ },
51
+ },
52
+ // Browser implementation uses window.performance (if available):
53
+ performance: {
54
+ name: "window.performance",
55
+ _startTime: 0,
56
+ _stopTime: 0,
57
57
 
58
- stop: () => { },
59
- elapsedMilliSec: () => 0,
58
+ stop: () => {},
59
+ elapsedMilliSec: () => 0,
60
60
 
61
- _start() {
62
- this._startTime = window.performance.now();
63
- },
64
- _stop() {
65
- this._stopTime = window.performance.now();
66
- },
67
- _elapsedSec(): number {
68
- if (!this._stopTime) {
69
- this.stop();
70
- }
71
- return this.elapsedMilliSec() / 1000;
72
- },
73
- _elapsedMilliSec(): number {
74
- if (!this._stopTime) {
75
- this.stop();
76
- }
77
- return this._stopTime - this._startTime;
78
- },
79
- _elapsedMicroSec(): number {
80
- if (!this._stopTime) {
81
- this.stop();
82
- }
83
- return this.elapsedMilliSec() * 1000;
84
- },
85
- },
86
- // Fallback is Date implementation if none of the above is supported:
87
- date: {
88
- name: "date",
89
- _startTime: new Date(),
90
- _stopTime: undefined as Date | undefined,
91
- stop: () => { },
92
- elapsedMilliSec: () => 0,
61
+ _start() {
62
+ this._startTime = window.performance.now();
63
+ },
64
+ _stop() {
65
+ this._stopTime = window.performance.now();
66
+ },
67
+ _elapsedSec(): number {
68
+ if (!this._stopTime) {
69
+ this.stop();
70
+ }
71
+ return this.elapsedMilliSec() / 1000;
72
+ },
73
+ _elapsedMilliSec(): number {
74
+ if (!this._stopTime) {
75
+ this.stop();
76
+ }
77
+ return this._stopTime - this._startTime;
78
+ },
79
+ _elapsedMicroSec(): number {
80
+ if (!this._stopTime) {
81
+ this.stop();
82
+ }
83
+ return this.elapsedMilliSec() * 1000;
84
+ },
85
+ },
86
+ // Fallback is Date implementation if none of the above is supported:
87
+ date: {
88
+ name: "date",
89
+ _startTime: new Date(),
90
+ _stopTime: undefined as Date | undefined,
91
+ stop: () => {},
92
+ elapsedMilliSec: () => 0,
93
93
 
94
- _start() {
95
- this._startTime = new Date();
96
- },
97
- _stop() {
98
- this._stopTime = new Date();
99
- },
100
- _elapsedSec(): number {
101
- if (!this._stopTime) {
102
- this.stop();
103
- }
104
- return this.elapsedMilliSec() / 1000;
105
- },
106
- _elapsedMilliSec(): number {
107
- if (!this._stopTime) {
108
- this.stop();
109
- }
110
- return (this._stopTime as Date).getTime() - this._startTime.getTime();
111
- },
112
- _elapsedMicroSec(): number {
113
- if (!this._stopTime) {
114
- this.stop();
115
- }
116
- return this.elapsedMilliSec() * 1000;
117
- },
118
- },
94
+ _start() {
95
+ this._startTime = new Date();
96
+ },
97
+ _stop() {
98
+ this._stopTime = new Date();
99
+ },
100
+ _elapsedSec(): number {
101
+ if (!this._stopTime) {
102
+ this.stop();
103
+ }
104
+ return this.elapsedMilliSec() / 1000;
105
+ },
106
+ _elapsedMilliSec(): number {
107
+ if (!this._stopTime) {
108
+ this.stop();
109
+ }
110
+ return (this._stopTime as Date).getTime() - this._startTime.getTime();
111
+ },
112
+ _elapsedMicroSec(): number {
113
+ if (!this._stopTime) {
114
+ this.stop();
115
+ }
116
+ return this.elapsedMilliSec() * 1000;
117
+ },
118
+ },
119
119
  };
120
120
 
121
- let impl: typeof implementations.date | typeof implementations.node | typeof implementations.performance;
121
+ let impl:
122
+ | typeof implementations.date
123
+ | typeof implementations.node
124
+ | typeof implementations.performance;
122
125
  if (typeof process !== "undefined" && typeof process.hrtime !== "undefined") {
123
- impl = implementations.node;
126
+ impl = implementations.node;
124
127
  } else if (
125
- typeof window !== "undefined" &&
126
- typeof window.performance !== "undefined" &&
127
- typeof window.performance.now !== "undefined"
128
+ typeof window !== "undefined" &&
129
+ typeof window.performance !== "undefined" &&
130
+ typeof window.performance.now !== "undefined"
128
131
  ) {
129
- impl = implementations.performance;
132
+ impl = implementations.performance;
130
133
  } else {
131
- impl = implementations.date;
134
+ impl = implementations.date;
132
135
  }
133
136
 
134
137
  /**
135
138
  * Creates and starts a new Chronometer.
136
139
  */
137
140
  export class Chronometer {
138
- constructor() {
139
- this.start();
140
- }
141
+ constructor() {
142
+ this.start();
143
+ }
141
144
 
142
- /**
143
- * Sets the chronometer start time.
144
- */
145
- start() {
146
- return impl._start.call(this);
147
- }
145
+ /**
146
+ * Sets the chronometer start time.
147
+ */
148
+ start() {
149
+ return impl._start.call(this);
150
+ }
148
151
 
149
- /**
150
- * Stops the chronometer. Stopped chronometers can be reused by calling {@link Chronometer.start} again.
151
- *
152
- * @returns The chronometer instance, so that callers can do this:
153
- *
154
- * ```javascript
155
- * let elapsedMS = chrono.stop().elapsedMS();
156
- * ```
157
- */
158
- stop(): Chronometer {
159
- impl._stop.call(this);
160
- return this;
161
- }
152
+ /**
153
+ * Stops the chronometer. Stopped chronometers can be reused by calling {@link Chronometer.start} again.
154
+ *
155
+ * @returns The chronometer instance, so that callers can do this:
156
+ *
157
+ * ```javascript
158
+ * let elapsedMS = chrono.stop().elapsedMS();
159
+ * ```
160
+ */
161
+ stop(): Chronometer {
162
+ impl._stop.call(this);
163
+ return this;
164
+ }
162
165
 
163
- /**
164
- * @returns How many microseconds have elapsed between the last call to {@link Chronometer.start}
165
- * (or the chronometer creation), and {@link Chronometer.stop}. Implementations that are not precise
166
- * enough may return "elapsedMilliSec() * 1000". Measuring elapsed time causes the chronometer
167
- * to be stopped if required (if the chrono is not stopped when this method is called).
168
- */
169
- elapsedMicroSec(): number {
170
- return impl._elapsedMicroSec.call(this);
171
- }
166
+ /**
167
+ * @returns How many microseconds have elapsed between the last call to {@link Chronometer.start}
168
+ * (or the chronometer creation), and {@link Chronometer.stop}. Implementations that are not precise
169
+ * enough may return "elapsedMilliSec() * 1000". Measuring elapsed time causes the chronometer
170
+ * to be stopped if required (if the chrono is not stopped when this method is called).
171
+ */
172
+ elapsedMicroSec(): number {
173
+ return impl._elapsedMicroSec.call(this);
174
+ }
172
175
 
173
- /**
174
- * @returns How many milliseconds have elapsed between the last call to {@link Chronometer.start}
175
- * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the
176
- * chronometer to be stopped if required (if the chrono is not stopped when this method is
177
- * called).
178
- */
179
- elapsedMilliSec(): number {
180
- return impl._elapsedMilliSec.call(this);
181
- }
176
+ /**
177
+ * @returns How many milliseconds have elapsed between the last call to {@link Chronometer.start}
178
+ * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the
179
+ * chronometer to be stopped if required (if the chrono is not stopped when this method is
180
+ * called).
181
+ */
182
+ elapsedMilliSec(): number {
183
+ return impl._elapsedMilliSec.call(this);
184
+ }
182
185
 
183
- /**
184
- * @returns How many seconds have elapsed between the last call to {@link Chronometer.start}
185
- * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the
186
- * chronometer to be stopped if required (if the chrono is not stopped when this method is
187
- * called).
188
- */
189
- elapsedSec(): number {
190
- return impl._elapsedSec.call(this);
191
- }
186
+ /**
187
+ * @returns How many seconds have elapsed between the last call to {@link Chronometer.start}
188
+ * (or the chronometer creation), and {@link Chronometer.stop}. Measuring elapsed time causes the
189
+ * chronometer to be stopped if required (if the chrono is not stopped when this method is
190
+ * called).
191
+ */
192
+ elapsedSec(): number {
193
+ return impl._elapsedSec.call(this);
194
+ }
192
195
 
193
- /**
194
- * A utility function to measure promise execution time.
195
- * @param promiseFn - A function that returns a promise whose execution time is to be measured.
196
- * @returns A Promise that resolves with an object with properties:
197
- *
198
- * - `chrono`: A stopped chronometer instance from which to get the elapsed time,
199
- *
200
- * - `result`: The resolved result of the promise returned by promiseFn
201
- */
202
- static async timePromise<T>(promiseFn: () => Promise<T>): Promise<{ chrono: Chronometer; result: T; }> {
203
- const chrono = new Chronometer();
204
- const result = await promiseFn();
205
- chrono.stop();
206
- return { chrono, result };
207
- }
196
+ /**
197
+ * A utility function to measure promise execution time.
198
+ * @param promiseFn - A function that returns a promise whose execution time is to be measured.
199
+ * @returns A Promise that resolves with an object with properties:
200
+ *
201
+ * - `chrono`: A stopped chronometer instance from which to get the elapsed time,
202
+ *
203
+ * - `result`: The resolved result of the promise returned by promiseFn
204
+ */
205
+ static async timePromise<T>(
206
+ promiseFn: () => Promise<T>,
207
+ ): Promise<{ chrono: Chronometer; result: T }> {
208
+ const chrono = new Chronometer();
209
+ const result = await promiseFn();
210
+ chrono.stop();
211
+ return { chrono, result };
212
+ }
208
213
  }
@@ -6,15 +6,20 @@
6
6
  /**
7
7
  * Used to replace console.assert to make sure that it always throws an error, both in the browser and in Node
8
8
  */
9
- export class ConsoleUtils { // eslint-disable-line @typescript-eslint/no-extraneous-class
10
- /**
11
- * Throws an error if the in_condition is false
12
- * @param in_condition - The condition we are testing: a boolean expression.
13
- * @param in_message - The error message that will be thrown if the condition is false.
14
- */
15
- static assert(condition: any, message: string | number): asserts condition {
16
- if (!(condition as boolean)) {
17
- throw new Error(typeof message === "number" ? `0x${message.toString(16).padStart(3, "0")}` : message);
18
- }
19
- }
9
+ // eslint-disable-next-line @typescript-eslint/no-extraneous-class
10
+ export class ConsoleUtils {
11
+ /**
12
+ * Throws an error if the in_condition is false
13
+ * @param in_condition - The condition we are testing: a boolean expression.
14
+ * @param in_message - The error message that will be thrown if the condition is false.
15
+ */
16
+ static assert(condition: any, message: string | number): asserts condition {
17
+ if (!(condition as boolean)) {
18
+ throw new Error(
19
+ typeof message === "number"
20
+ ? `0x${message.toString(16).padStart(3, "0")}`
21
+ : message,
22
+ );
23
+ }
24
+ }
20
25
  }