@gesslar/toolkit 0.7.1 → 1.0.0

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 (53) hide show
  1. package/README.md +35 -0
  2. package/package.json +22 -10
  3. package/src/browser/index.js +10 -0
  4. package/src/{lib → browser/lib}/Data.js +24 -0
  5. package/src/browser/lib/Sass.js +168 -0
  6. package/src/browser/lib/Tantrum.js +115 -0
  7. package/src/browser/lib/Util.js +257 -0
  8. package/src/browser/lib/Valid.js +76 -0
  9. package/src/index.js +14 -12
  10. package/src/lib/Cache.js +2 -3
  11. package/src/lib/Contract.js +3 -4
  12. package/src/lib/FS.js +15 -20
  13. package/src/lib/FileObject.js +71 -14
  14. package/src/lib/Glog.js +2 -2
  15. package/src/lib/Sass.js +2 -91
  16. package/src/lib/Schemer.js +2 -2
  17. package/src/lib/Tantrum.js +3 -70
  18. package/src/lib/Terms.js +2 -3
  19. package/src/lib/Util.js +2 -252
  20. package/src/lib/Valid.js +17 -20
  21. package/src/types/browser/index.d.ts +8 -0
  22. package/src/types/browser/index.d.ts.map +1 -0
  23. package/src/types/browser/lib/Collection.d.ts +246 -0
  24. package/src/types/browser/lib/Collection.d.ts.map +1 -0
  25. package/src/types/browser/lib/Data.d.ts +206 -0
  26. package/src/types/browser/lib/Data.d.ts.map +1 -0
  27. package/src/types/browser/lib/Sass.d.ts +62 -0
  28. package/src/types/browser/lib/Sass.d.ts.map +1 -0
  29. package/src/types/browser/lib/Tantrum.d.ts +51 -0
  30. package/src/types/browser/lib/Tantrum.d.ts.map +1 -0
  31. package/src/types/browser/lib/TypeSpec.d.ts +92 -0
  32. package/src/types/browser/lib/TypeSpec.d.ts.map +1 -0
  33. package/src/types/browser/lib/Util.d.ts +129 -0
  34. package/src/types/browser/lib/Util.d.ts.map +1 -0
  35. package/src/types/browser/lib/Valid.d.ts +33 -0
  36. package/src/types/browser/lib/Valid.d.ts.map +1 -0
  37. package/src/types/index.d.ts +10 -10
  38. package/src/types/lib/Data.d.ts +17 -0
  39. package/src/types/lib/Data.d.ts.map +1 -1
  40. package/src/types/lib/FS.d.ts +2 -2
  41. package/src/types/lib/FS.d.ts.map +1 -1
  42. package/src/types/lib/FileObject.d.ts +31 -1
  43. package/src/types/lib/FileObject.d.ts.map +1 -1
  44. package/src/types/lib/Sass.d.ts +2 -55
  45. package/src/types/lib/Sass.d.ts.map +1 -1
  46. package/src/types/lib/Tantrum.d.ts +3 -44
  47. package/src/types/lib/Tantrum.d.ts.map +1 -1
  48. package/src/types/lib/Util.d.ts +3 -124
  49. package/src/types/lib/Util.d.ts.map +1 -1
  50. package/src/types/lib/Valid.d.ts +1 -1
  51. package/src/types/lib/Valid.d.ts.map +1 -1
  52. /package/src/{lib → browser/lib}/Collection.js +0 -0
  53. /package/src/{lib → browser/lib}/TypeSpec.js +0 -0
@@ -65,6 +65,6 @@ export default class FS {
65
65
  */
66
66
  static resolvePath(fromPath: string, toPath: string): string;
67
67
  }
68
- import FileObject from "./FileObject.js";
69
- import DirectoryObject from "./DirectoryObject.js";
68
+ export type FileObject = import("./FileObject.js").default;
69
+ export type DirectoryObject = import("./DirectoryObject.js").default;
70
70
  //# sourceMappingURL=FS.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FS.d.ts","sourceRoot":"","sources":["../../lib/FS.js"],"names":[],"mappings":"AAuBA;;GAEG;AACH;IACE,kCAAwB;IACxB,uCAAkC;IAClC,mBAAsB;IAEtB;;;;;OAKG;IACH,4BAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;OAKG;IACH,2BAHW,MAAM,GACJ,MAAM,CAUlB;IAED;;;;;OAKG;IACH,2BAHW,MAAM,GACJ,MAAM,CAQlB;IAED;;;;;;;OAOG;IACH,sBALW,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,GAClB,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAyCtC;IAED;;;;;;;;;OASG;IACH,oCAJW,UAAU,GAAC,eAAe,MAC1B,UAAU,GAAC,eAAe,GACxB,MAAM,CAYlB;IAED;;;;;;;OAOG;IACH,oCALW,MAAM,SACN,MAAM,QACN,MAAM,GACJ,MAAM,CA2BlB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,UACN,MAAM,GACJ,MAAM,CAgClB;CACF;uBAzMsB,iBAAiB;4BADZ,sBAAsB"}
1
+ {"version":3,"file":"FS.d.ts","sourceRoot":"","sources":["../../lib/FS.js"],"names":[],"mappings":"AAwBA;;GAEG;AACH;IACE,kCAAwB;IACxB,uCAAkC;IAClC,mBAAsB;IAEtB;;;;;OAKG;IACH,4BAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;OAKG;IACH,2BAHW,MAAM,GACJ,MAAM,CAUlB;IAED;;;;;OAKG;IACH,2BAHW,MAAM,GACJ,MAAM,CAQlB;IAED;;;;;;;OAOG;IACH,sBALW,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,GAClB,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAmCtC;IAED;;;;;;;;;OASG;IACH,oCAJW,UAAU,GAAC,eAAe,MAC1B,UAAU,GAAC,eAAe,GACxB,MAAM,CAYlB;IAED;;;;;;;OAOG;IACH,oCALW,MAAM,SACN,MAAM,QACN,MAAM,GACJ,MAAM,CA2BlB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,UACN,MAAM,GACJ,MAAM,CAgClB;CACF;yBAlMa,OAAO,iBAAiB,EAAE,OAAO;8BACjC,OAAO,sBAAsB,EAAE,OAAO"}
@@ -138,6 +138,19 @@ export default class FileObject extends FS {
138
138
  * @returns {Promise<string>} The file contents
139
139
  */
140
140
  read(encoding?: string): Promise<string>;
141
+ /**
142
+ * Reads binary data from a file asynchronously.
143
+ * Returns the file contents as a Buffer (Node.js binary data type).
144
+ *
145
+ * @returns {Promise<Buffer>} The file contents as a Buffer
146
+ * @throws {Sass} If the file URL is invalid
147
+ * @throws {Sass} If the file does not exist
148
+ * @example
149
+ * const file = new FileObject('./image.png')
150
+ * const buffer = await file.readBinary()
151
+ * // Use the buffer (e.g., send in HTTP response, process image, etc.)
152
+ */
153
+ readBinary(): Promise<Buffer>;
141
154
  /**
142
155
  * Writes content to a file asynchronously.
143
156
  * Validates that the parent directory exists before writing.
@@ -145,12 +158,29 @@ export default class FileObject extends FS {
145
158
  * @param {string} content - The content to write
146
159
  * @param {string} [encoding] - The encoding in which to write (default: "utf8")
147
160
  * @returns {Promise<void>}
148
- * @throws {Sass} If the file path is invalid or the parent directory doesn't exist
161
+ * @throws {Sass} If the file URL is invalid or the parent directory doesn't exist
149
162
  * @example
150
163
  * const file = new FileObject('./output/data.json')
151
164
  * await file.write(JSON.stringify({key: 'value'}))
152
165
  */
153
166
  write(content: string, encoding?: string): Promise<void>;
167
+ /**
168
+ * Writes binary data to a file asynchronously.
169
+ * Validates that the parent directory exists and that the data is valid binary format.
170
+ * Supports ArrayBuffer, TypedArrays (Uint8Array, etc.), Blob, and Node Buffer types.
171
+ *
172
+ * @param {ArrayBuffer|Blob|Buffer} data - The binary data to write
173
+ * @returns {Promise<void>}
174
+ * @throws {Sass} If the file URL is invalid
175
+ * @throws {Sass} If the parent directory doesn't exist
176
+ * @throws {Sass} If the data is not a valid binary type
177
+ * @example
178
+ * const file = new FileObject('./output/image.png')
179
+ * const response = await fetch('https://example.com/image.png')
180
+ * const buffer = await response.arrayBuffer()
181
+ * await file.writeBinary(buffer)
182
+ */
183
+ writeBinary(data: ArrayBuffer | Blob | Buffer): Promise<void>;
154
184
  /**
155
185
  * Loads an object from JSON or YAML file.
156
186
  * Attempts to parse content as JSON5 first, then falls back to YAML if specified.
@@ -1 +1 @@
1
- {"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../lib/FileObject.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;GAcG;AAEH;IACE;;;;;OAKG;IACH,yBAFU;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,KAAK,GAAG,O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,CAkB3B;IAED;;;;;;;;;;;OAWG;IACH,eARW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAezB;IAED;;;;;;;;;;;;;;;OAeG;IACH,kBAXW,WAAW,GAAC,IAAI,GAAC,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAyBzB;IAED;;;;;;;;;;;;;;OAcG;IACH,gBAXW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAkC5B;IAED;;;;OAIG;IACH,UAFa,OAAO,CAAC,MAAM,CAAC,CAY3B;IAED;;;;;;;;;OASG;IACH,UAPa,OAAO,CAAC,IAAI,CAAC,CAiBzB;IA7XD;;;;OAIG;IACH,yBAFa,MAAM,CAIlB;;CAuXF;eAjgBc,SAAS;oBAJN,UAAU;4BAGA,sBAAsB;iBALjC,WAAW;kBAHV,OAAO;iBAIR,MAAM"}
@@ -2,61 +2,8 @@
2
2
  * Custom error class for toolkit errors.
3
3
  * Provides error chaining, trace management, and formatted error reporting.
4
4
  */
5
- export default class Sass extends Error {
6
- /**
7
- * Creates an Sass from an existing Error object with additional
8
- * trace message.
9
- *
10
- * @param {Error} error - The original error object
11
- * @param {string} message - Additional trace message to add
12
- * @returns {Sass} New Sass instance with trace from the original error
13
- * @throws {Sass} If the first parameter is not an Error instance
14
- */
15
- static from(error: Error, message: string): Sass;
16
- /**
17
- * Factory method to create or enhance Sass instances.
18
- * If error parameter is provided, enhances existing Sass or wraps
19
- * other errors. Otherwise creates a new Sass instance.
20
- *
21
- * @param {string} message - The error message
22
- * @param {Error|Sass|Tantrum} [error] - Optional existing error to wrap or enhance
23
- * @returns {Sass} New or enhanced Sass instance
24
- */
25
- static "new"(message: string, error?: Error | Sass | Tantrum): Sass;
26
- /**
27
- * Creates a new Sass instance.
28
- *
29
- * @param {string} message - The error message
30
- * @param {...unknown} [arg] - Additional arguments passed to parent Error constructor
31
- */
32
- constructor(message: string, ...arg?: unknown[]);
33
- /**
34
- * Adds a message to the beginning of the trace array.
35
- *
36
- * @param {string} message - The trace message to add
37
- */
38
- set trace(message: string);
39
- /**
40
- * Gets the error trace array.
41
- *
42
- * @returns {Array<string>} Array of trace messages
43
- */
44
- get trace(): Array<string>;
45
- /**
46
- * Adds a trace message and returns this instance for chaining.
47
- *
48
- * @param {string} message - The trace message to add
49
- * @returns {this} This Sass instance for method chaining
50
- */
51
- addTrace(message: string): this;
52
- /**
53
- * Reports the error to the terminal with formatted output.
54
- * Optionally includes detailed stack trace information.
55
- *
56
- * @param {boolean} [nerdMode] - Whether to include detailed stack trace
57
- */
58
- report(nerdMode?: boolean): void;
5
+ export default class Sass extends BrowserSass {
59
6
  #private;
60
7
  }
61
- import Tantrum from "./Tantrum.js";
8
+ import { Sass as BrowserSass } from "../browser/index.js";
62
9
  //# sourceMappingURL=Sass.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sass.d.ts","sourceRoot":"","sources":["../../lib/Sass.js"],"names":[],"mappings":"AAgBA;;;GAGG;AACH;IA2GE;;;;;;;;OAQG;IACH,mBALW,KAAK,WACL,MAAM,GACJ,IAAI,CAWhB;IAED;;;;;;;;OAQG;IACH,sBAJW,MAAM,UACN,KAAK,GAAC,IAAI,GAAC,OAAO,GAChB,IAAI,CAchB;IAhJD;;;;;OAKG;IACH,qBAHW,MAAM,WACH,OAAO,EAAA,EAMpB;IAWD;;;;OAIG;IACH,mBAFW,MAAM,EAIhB;IAhBD;;;;OAIG;IACH,aAFa,KAAK,CAAC,MAAM,CAAC,CAIzB;IAWD;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,IAAI,CAShB;IAED;;;;;OAKG;IACH,kBAFW,OAAO,QAqBjB;;CA2EF;oBA1JmB,cAAc"}
1
+ {"version":3,"file":"Sass.d.ts","sourceRoot":"","sources":["../../lib/Sass.js"],"names":[],"mappings":"AAgBA;;;GAGG;AACH;;CA2DC;oCAlEiC,qBAAqB"}
@@ -2,49 +2,8 @@
2
2
  * Custom aggregate error class that extends AggregateError.
3
3
  * Automatically wraps plain errors in Sass instances for consistent reporting.
4
4
  */
5
- export default class Tantrum extends AggregateError {
6
- /**
7
- * Factory method to create a Tantrum instance.
8
- *
9
- * @param {string} message - The aggregate error message
10
- * @param {Array<Error|Sass>} errors - Array of errors to aggregate
11
- * @returns {Tantrum} New Tantrum instance
12
- */
13
- static "new"(message: string, errors?: Array<Error | Sass>): Tantrum;
14
- /**
15
- * Creates a new Tantrum instance.
16
- *
17
- * @param {string} message - The aggregate error message
18
- * @param {Array<Error|Sass>} errors - Array of errors to aggregate
19
- */
20
- constructor(message: string, errors?: Array<Error | Sass>);
21
- /**
22
- * Adds a trace message and returns this instance for chaining.
23
- *
24
- * @param {string} message - The trace message to add
25
- * @param {Error|Sass} [_error] - Optional error (currently unused, reserved for future use)
26
- * @returns {this} This Tantrum instance for method chaining
27
- */
28
- addTrace(message: string, _error?: Error | Sass): this;
29
- /**
30
- * Adds a message to the beginning of the trace array.
31
- *
32
- * @param {string} message - The trace message to add
33
- */
34
- set trace(message: string);
35
- /**
36
- * Gets the error trace array.
37
- *
38
- * @returns {Array<string>} Array of trace messages
39
- */
40
- get trace(): Array<string>;
41
- /**
42
- * Reports all aggregated errors to the terminal with formatted output.
43
- *
44
- * @param {boolean} [nerdMode] - Whether to include detailed stack traces
45
- */
46
- report(nerdMode?: boolean): void;
47
- #private;
5
+ export default class Tantrum extends BrowserTantrum {
6
+ constructor(message: any, errors?: any[]);
48
7
  }
49
- import Sass from "./Sass.js";
8
+ import { Tantrum as BrowserTantrum } from "../browser/index.js";
50
9
  //# sourceMappingURL=Tantrum.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tantrum.d.ts","sourceRoot":"","sources":["../../lib/Tantrum.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH;IAgFE;;;;;;OAMG;IACH,sBAJW,MAAM,WACN,KAAK,CAAC,KAAK,GAAC,IAAI,CAAC,GACf,OAAO,CAOnB;IAzFD;;;;;OAKG;IACH,qBAHW,MAAM,WACN,KAAK,CAAC,KAAK,GAAC,IAAI,CAAC,EAgB3B;IAED;;;;;;OAMG;IACH,kBAJW,MAAM,WACN,KAAK,GAAC,IAAI,GACR,IAAI,CAShB;IAWD;;;;OAIG;IACH,mBAFW,MAAM,EAIhB;IAhBD;;;;OAIG;IACH,aAFa,KAAK,CAAC,MAAM,CAAC,CAIzB;IAWD;;;;OAIG;IACH,kBAFW,OAAO,QAgBjB;;CAeF;iBApGgB,WAAW"}
1
+ {"version":3,"file":"Tantrum.d.ts","sourceRoot":"","sources":["../../lib/Tantrum.js"],"names":[],"mappings":"AAeA;;;GAGG;AACH;IACE,0CAEC;CAsBF;0CAjCuC,qBAAqB"}
@@ -2,43 +2,7 @@
2
2
  * Utility class providing common helper functions for string manipulation,
3
3
  * timing, hashing, and option parsing.
4
4
  */
5
- export default class Util {
6
- /**
7
- * Capitalizes the first letter of a string.
8
- *
9
- * @param {string} text - The text to capitalize
10
- * @returns {string} Text with first letter capitalized
11
- */
12
- static capitalize(text: string): string;
13
- /**
14
- * Measure wall-clock time for an async function.
15
- *
16
- * @template T
17
- * @param {() => Promise<T>} fn - Thunk returning a promise.
18
- * @returns {Promise<{result: T, cost: number}>} Object containing result and elapsed ms (number, 1 decimal).
19
- */
20
- static time<T>(fn: () => Promise<T>): Promise<{
21
- result: T;
22
- cost: number;
23
- }>;
24
- /**
25
- * Right-align a string inside a fixed width (left pad with spaces).
26
- * If the string exceeds width it is returned unchanged.
27
- *
28
- * @param {string|number} text - Text to align.
29
- * @param {number} width - Target field width (default 80).
30
- * @returns {string} Padded string.
31
- */
32
- static rightAlignText(text: string | number, width?: number): string;
33
- /**
34
- * Centre-align a string inside a fixed width (pad with spaces on left).
35
- * If the string exceeds width it is returned unchanged.
36
- *
37
- * @param {string|number} text - Text to align.
38
- * @param {number} width - Target field width (default 80).
39
- * @returns {string} Padded string with text centred.
40
- */
41
- static centreAlignText(text: string | number, width?: number): string;
5
+ export default class Util extends BrowserUtil {
42
6
  /**
43
7
  * Compute sha256 hash (hex) of the provided string.
44
8
  *
@@ -71,73 +35,6 @@ export default class Util {
71
35
  * @returns {Array<string>} Array of canonical option names (long preferred, short if no long present).
72
36
  */
73
37
  static generateOptionNames(object: object): Array<string>;
74
- /**
75
- * Asynchronously awaits all promises in parallel.
76
- * Wrapper around Promise.all for consistency with other utility methods.
77
- *
78
- * @param {Array<Promise<unknown>>} promises - Array of promises to await
79
- * @returns {Promise<Array<unknown>>} Results of all promises
80
- */
81
- static awaitAll(promises: Array<Promise<unknown>>): Promise<Array<unknown>>;
82
- /**
83
- * Settles all promises (both fulfilled and rejected) in parallel.
84
- * Wrapper around Promise.allSettled for consistency with other utility methods.
85
- *
86
- * @param {Array<Promise<unknown>>} promises - Array of promises to settle
87
- * @returns {Promise<Array<object>>} Results of all settled promises with status and value/reason
88
- */
89
- static settleAll(promises: Array<Promise<unknown>>): Promise<Array<object>>;
90
- /**
91
- * Checks if any result in the settled promise array is rejected.
92
- *
93
- * @param {Array<object>} result - Array of settled promise results.
94
- * @returns {boolean} True if any result is rejected, false otherwise.
95
- */
96
- static anyRejected(result: Array<object>): boolean;
97
- /**
98
- * Filters and returns all rejected results from a settled promise array.
99
- *
100
- * @param {Array<object>} result - Array of settled promise results.
101
- * @returns {Array<object>} Array of rejected results.
102
- */
103
- static settledAndRejected(result: Array<object>): Array<object>;
104
- /**
105
- * Extracts the rejection reasons from an array of rejected promise results.
106
- *
107
- * @param {Array<object>} rejected - Array of rejected results.
108
- * @returns {Array<unknown>} Array of rejection reasons.
109
- */
110
- static rejectedReasons(rejected: Array<object>): Array<unknown>;
111
- /**
112
- * Throws a Sass error containing all rejection reasons from settled promises.
113
- *
114
- * @param {string} [_message] - Optional error message. Defaults to "GIGO"
115
- * @param {Array<object>} rejected - Array of rejected results.
116
- * @throws {Error} Throws a Sass error with rejection reasons.
117
- */
118
- static throwRejected(_message?: string, rejected: Array<object>): void;
119
- /**
120
- * Filters and returns all fulfilled results from a settled promise array.
121
- *
122
- * @param {Array<object>} result - Array of settled promise results.
123
- * @returns {Array<object>} Array of fulfilled results.
124
- */
125
- static settledAndFulfilled(result: Array<object>): Array<object>;
126
- /**
127
- * Extracts the values from all fulfilled results in a settled promise array.
128
- *
129
- * @param {Array<object>} result - Array of settled promise results.
130
- * @returns {Array<unknown>} Array of fulfilled values.
131
- */
132
- static fulfilledValues(result: Array<object>): Array<unknown>;
133
- /**
134
- * Returns the first promise to resolve or reject from an array of promises.
135
- * Wrapper around Promise.race for consistency with other utility methods.
136
- *
137
- * @param {Array<Promise<unknown>>} promises - Array of promises to race
138
- * @returns {Promise<unknown>} Result of the first settled promise
139
- */
140
- static race(promises: Array<Promise<unknown>>): Promise<unknown>;
141
38
  /**
142
39
  * Private method that performs the actual async emission logic.
143
40
  * Handles listener execution, error aggregation, and result processing.
@@ -171,28 +68,10 @@ export default class Util {
171
68
  * @param {object} emitter - Any object with EventEmitter-like interface
172
69
  * @param {string} event - The event name to emit
173
70
  * @param {...unknown} args - Arguments to pass to event listeners
174
- * @returns {Promise<void>} Resolves when all listeners have completed
71
+ * @returns {Promise<void>} Resolves when all listeners have completed, but no grapes.
175
72
  */
176
73
  static asyncEmitQuack(emitter: object, event: string, ...args: unknown[]): Promise<void>;
177
- /**
178
- * Determine the Levenshtein distance between two string values
179
- *
180
- * @param {string} a The first value for comparison.
181
- * @param {string} b The second value for comparison.
182
- * @returns {number} The Levenshtein distance
183
- */
184
- static levenshteinDistance(a: string, b: string): number;
185
- /**
186
- * Determine the closest match between a string and allowed values
187
- * from the Levenshtein distance.
188
- *
189
- * @param {string} input The input string to resolve
190
- * @param {Array<string>} allowedValues The values which are permitted
191
- * @param {number} [threshold] Max edit distance for a "close match"
192
- * @returns {string} Suggested, probable match.
193
- */
194
- static findClosestMatch(input: string, allowedValues: Array<string>, threshold?: number): string;
195
- static regexify(input: any, trim?: boolean, flags?: any[]): RegExp;
196
74
  }
75
+ import { Util as BrowserUtil } from "../browser/index.js";
197
76
  import { EventEmitter } from "node:events";
198
77
  //# sourceMappingURL=Util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../lib/Util.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH;IACE;;;;;OAKG;IACH,wBAHW,MAAM,GACJ,MAAM,CAYlB;IAED;;;;;;OAMG;IACH,YAJa,CAAC,MACH,MAAM,OAAO,CAAC,CAAC,CAAC,GACd,OAAO,CAAC;QAAC,MAAM,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC,CAQ9C;IAED;;;;;;;OAOG;IACH,4BAJW,MAAM,GAAC,MAAM,UACb,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,GAAC,MAAM,UACb,MAAM,GACJ,MAAM,CAalB;IAED;;;;;OAKG;IACH,iBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,mCAHW,MAAM,GACJ,KAAK,CAAC,MAAM,CAAC,CAazB;IAED;;;;;;OAMG;IACH,0BAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACrB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAInC;IAED;;;;;;OAMG;IACH,2BAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACrB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAIlC;IAED;;;;;OAKG;IACH,2BAHW,KAAK,CAAC,MAAM,CAAC,GACX,OAAO,CAInB;IAED;;;;;OAKG;IACH,kCAHW,KAAK,CAAC,MAAM,CAAC,GACX,KAAK,CAAC,MAAM,CAAC,CAIzB;IAED;;;;;OAKG;IACH,iCAHW,KAAK,CAAC,MAAM,CAAC,GACX,KAAK,CAAC,OAAO,CAAC,CAI1B;IAED;;;;;;OAMG;IACH,gCAJW,MAAM,YACN,KAAK,CAAC,MAAM,CAAC,QAKvB;IAED;;;;;OAKG;IACH,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;OAUG;IACH,+BALW,MAAM,SACN,MAAM,WACH,OAAO,EAAA,GACR,OAAO,CAAC,IAAI,CAAC,CAyBzB;CACF;oCAvJiC,qBAAqB;6BAF5B,aAAa"}
@@ -2,6 +2,7 @@
2
2
  * Validation utility class providing type checking and assertion methods.
3
3
  */
4
4
  export default class Valid {
5
+ static "__#private@#restrictedProto": string[];
5
6
  /**
6
7
  * Validates a value against a type. Uses Data.isType.
7
8
  *
@@ -20,7 +21,6 @@ export default class Valid {
20
21
  * met (optional)
21
22
  */
22
23
  static assert(condition: boolean, message: string, arg?: number): void;
23
- static "__#private@#restrictedProto": string[];
24
24
  /**
25
25
  * Protects against prototype pollution by checking keys for dangerous property names.
26
26
  * Throws if any restricted prototype properties are found in the keys array.
@@ -1 +1 @@
1
- {"version":3,"file":"Valid.d.ts","sourceRoot":"","sources":["../../lib/Valid.js"],"names":[],"mappings":"AAaA;;GAEG;AACH;IACE;;;;;;OAMG;IACH,mBAJW,OAAO,QACP,MAAM,YACN,MAAM,QAQhB;IAED;;;;;;;;OAQG;IACH,yBANW,OAAO,WACP,MAAM,QAEN,MAAM,QAmBhB;IAED,+CAAmE;IAEnE;;;;;;OAMG;IACH,0CAHW,KAAK,CAAC,MAAM,CAAC,QAYvB;CACF"}
1
+ {"version":3,"file":"Valid.d.ts","sourceRoot":"","sources":["../../lib/Valid.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE,+CAAmE;IAEnE;;;;;;OAMG;IACH,mBAJW,OAAO,QACP,MAAM,YACN,MAAM,QAQhB;IAED;;;;;;;;OAQG;IACH,yBANW,OAAO,WACP,MAAM,QAEN,MAAM,QAkBhB;IAED;;;;;;OAMG;IACH,0CAHW,KAAK,CAAC,MAAM,CAAC,QAYvB;CACF"}
File without changes
File without changes