utilitas 1995.2.83 → 1995.2.84
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/README.md +1 -1
- package/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/horizon.mjs +5 -0
- package/lib/manifest.mjs +1 -1
- package/lib/utilitas.mjs +10 -3
- package/package.json +1 -1
package/lib/horizon.mjs
CHANGED
|
@@ -6,6 +6,11 @@ RegExp.escape = RegExp.escape || (str => { //$& means the whole matched string
|
|
|
6
6
|
return String(str).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
7
7
|
}); // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
|
|
8
8
|
|
|
9
|
+
// BigInt
|
|
10
|
+
BigInt.prototype.toJSON = BigInt.prototype.toJSON || function() {
|
|
11
|
+
return this.toString();
|
|
12
|
+
};
|
|
13
|
+
|
|
9
14
|
// Assert
|
|
10
15
|
import { default as asst } from 'assert';
|
|
11
16
|
const _assert = asst || ((val, err) => {
|
package/lib/manifest.mjs
CHANGED
package/lib/utilitas.mjs
CHANGED
|
@@ -267,9 +267,16 @@ const decode = (string, toBuf, encoding) => {
|
|
|
267
267
|
return toBuf ? buf : buf.toString('utf8');
|
|
268
268
|
};
|
|
269
269
|
|
|
270
|
-
const parseJson = (any, fallback) => {
|
|
271
|
-
try {
|
|
272
|
-
|
|
270
|
+
const parseJson = (any, fallback, options) => {
|
|
271
|
+
try {
|
|
272
|
+
return JSON.parse(any, options?.reviver || ((key, value) => {
|
|
273
|
+
if (value && value.type === 'Buffer' && Array.isArray(value.data)) {
|
|
274
|
+
return Buffer.from(value.data);
|
|
275
|
+
}
|
|
276
|
+
return value;
|
|
277
|
+
|
|
278
|
+
}));
|
|
279
|
+
} catch (e) { return isSet(fallback) ? fallback : {}; }
|
|
273
280
|
};
|
|
274
281
|
|
|
275
282
|
const extract = (...path) => {
|