@dxos/util 0.8.4-main.84f28bd → 0.8.4-main.ae835ea
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/lib/browser/index.mjs +162 -94
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +162 -94
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/array.d.ts.map +1 -1
- package/dist/types/src/assume.d.ts.map +1 -1
- package/dist/types/src/di-key.d.ts +3 -3
- package/dist/types/src/di-key.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/json.d.ts +1 -1
- package/dist/types/src/json.d.ts.map +1 -1
- package/dist/types/src/object.d.ts +3 -0
- package/dist/types/src/object.d.ts.map +1 -1
- package/dist/types/src/safe-parse.d.ts.map +1 -1
- package/dist/types/src/string.d.ts +8 -0
- package/dist/types/src/string.d.ts.map +1 -1
- package/dist/types/src/string.test.d.ts +2 -0
- package/dist/types/src/string.test.d.ts.map +1 -0
- package/dist/types/src/to-fallback.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/unit.d.ts +15 -0
- package/dist/types/src/unit.d.ts.map +1 -0
- package/dist/types/src/unit.test.d.ts +2 -0
- package/dist/types/src/unit.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/array.test.ts +1 -1
- package/src/array.ts +0 -2
- package/src/assume.ts +0 -1
- package/src/circular-buffer.test.ts +1 -1
- package/src/complex.test.ts +1 -1
- package/src/human-hash.test.ts +1 -1
- package/src/index.ts +1 -2
- package/src/json.ts +2 -7
- package/src/object.ts +3 -0
- package/src/position.test.ts +2 -2
- package/src/safe-parse.ts +6 -3
- package/src/sort.test.ts +1 -1
- package/src/string.test.ts +19 -0
- package/src/string.ts +36 -0
- package/src/to-fallback.ts +5 -4
- package/src/tree.test.ts +1 -1
- package/src/types.ts +1 -1
- package/src/uint8array.test.ts +1 -1
- package/src/unit.test.ts +25 -0
- package/src/unit.ts +52 -0
- package/src/weak.test.ts +1 -1
- package/dist/types/src/first-two-chars.d.ts +0 -9
- package/dist/types/src/first-two-chars.d.ts.map +0 -1
- package/src/first-two-chars.ts +0 -44
|
@@ -207,6 +207,7 @@ var CallbackCollection = class {
|
|
|
207
207
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
208
208
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/util/src/callback.ts";
|
|
209
209
|
var Callback = class {
|
|
210
|
+
_callback;
|
|
210
211
|
call(...args) {
|
|
211
212
|
invariant2(this._callback, "Callback not set", {
|
|
212
213
|
F: __dxlog_file2,
|
|
@@ -301,9 +302,10 @@ var chunkArray = (array, size) => {
|
|
|
301
302
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
302
303
|
var __dxlog_file3 = "/__w/dxos/dxos/packages/common/util/src/circular-buffer.ts";
|
|
303
304
|
var CircularBuffer = class {
|
|
305
|
+
_buffer;
|
|
306
|
+
_nextIndex = 0;
|
|
307
|
+
_elementCount = 0;
|
|
304
308
|
constructor(size) {
|
|
305
|
-
this._nextIndex = 0;
|
|
306
|
-
this._elementCount = 0;
|
|
307
309
|
invariant3(size >= 1, void 0, {
|
|
308
310
|
F: __dxlog_file3,
|
|
309
311
|
L: 13,
|
|
@@ -374,10 +376,11 @@ import { inspect } from "@dxos/node-std/util";
|
|
|
374
376
|
import { inspectObject, raise } from "@dxos/debug";
|
|
375
377
|
var MAX_SERIALIZATION_LENGTH = 10;
|
|
376
378
|
var ComplexSet = class {
|
|
379
|
+
_projection;
|
|
380
|
+
_values = /* @__PURE__ */ new Map();
|
|
377
381
|
// prettier-ignore
|
|
378
382
|
constructor(_projection, values) {
|
|
379
383
|
this._projection = _projection;
|
|
380
|
-
this._values = /* @__PURE__ */ new Map();
|
|
381
384
|
if (values) {
|
|
382
385
|
for (const value of values) {
|
|
383
386
|
this.add(value);
|
|
@@ -467,11 +470,12 @@ var makeSet = (projection) => {
|
|
|
467
470
|
};
|
|
468
471
|
};
|
|
469
472
|
var ComplexMap = class _ComplexMap {
|
|
473
|
+
_keyProjection;
|
|
474
|
+
_keys = /* @__PURE__ */ new Map();
|
|
475
|
+
_values = /* @__PURE__ */ new Map();
|
|
470
476
|
// prettier-ignore
|
|
471
477
|
constructor(_keyProjection, entries2) {
|
|
472
478
|
this._keyProjection = _keyProjection;
|
|
473
|
-
this._keys = /* @__PURE__ */ new Map();
|
|
474
|
-
this._values = /* @__PURE__ */ new Map();
|
|
475
479
|
if (entries2) {
|
|
476
480
|
for (const [key, value] of entries2) {
|
|
477
481
|
this.set(key, value);
|
|
@@ -599,6 +603,7 @@ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
|
599
603
|
// src/defer.ts
|
|
600
604
|
var defer = (fn) => new DeferGuard(fn);
|
|
601
605
|
var DeferGuard = class {
|
|
606
|
+
_fn;
|
|
602
607
|
/**
|
|
603
608
|
* @internal
|
|
604
609
|
*/
|
|
@@ -614,6 +619,7 @@ var DeferGuard = class {
|
|
|
614
619
|
};
|
|
615
620
|
var deferAsync = (fn) => new DeferAsyncGuard(fn);
|
|
616
621
|
var DeferAsyncGuard = class {
|
|
622
|
+
_fn;
|
|
617
623
|
/**
|
|
618
624
|
* @internal
|
|
619
625
|
*/
|
|
@@ -628,6 +634,8 @@ var DeferAsyncGuard = class {
|
|
|
628
634
|
// src/entry.ts
|
|
629
635
|
var entry = (map, key) => new MapEntry(map, key);
|
|
630
636
|
var MapEntry = class {
|
|
637
|
+
_map;
|
|
638
|
+
_key;
|
|
631
639
|
/**
|
|
632
640
|
* @internal
|
|
633
641
|
*/
|
|
@@ -653,33 +661,6 @@ var MapEntry = class {
|
|
|
653
661
|
}
|
|
654
662
|
};
|
|
655
663
|
|
|
656
|
-
// src/first-two-chars.ts
|
|
657
|
-
var renderableCharRegex = /^(?![\p{Control}\p{Mark}\p{Separator}\p{Surrogate}\p{Unassigned}\p{P}])[\p{L}\p{N}\p{S}\p{Emoji}]$/u;
|
|
658
|
-
var getFirstTwoRenderableChars = (label) => {
|
|
659
|
-
const characters = Array.from(label);
|
|
660
|
-
const result = [
|
|
661
|
-
"",
|
|
662
|
-
""
|
|
663
|
-
];
|
|
664
|
-
let foundFirst = false;
|
|
665
|
-
for (let i = 0; i < characters.length; i++) {
|
|
666
|
-
const char = characters[i];
|
|
667
|
-
if (renderableCharRegex.test(char)) {
|
|
668
|
-
if (!foundFirst) {
|
|
669
|
-
result[0] = char;
|
|
670
|
-
foundFirst = true;
|
|
671
|
-
} else {
|
|
672
|
-
const textBetween = characters.slice(result[0].length, i).join("");
|
|
673
|
-
if (/[^\p{L}\p{N}_]/u.test(textBetween)) {
|
|
674
|
-
result[1] = char;
|
|
675
|
-
break;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
return result;
|
|
681
|
-
};
|
|
682
|
-
|
|
683
664
|
// src/for-each-async.ts
|
|
684
665
|
var forEachAsync = (items, fn) => Promise.all(items.map(fn));
|
|
685
666
|
|
|
@@ -944,6 +925,7 @@ var DEFAULT_WORDLIST = [
|
|
|
944
925
|
"zulu"
|
|
945
926
|
];
|
|
946
927
|
var HumanHasher = class {
|
|
928
|
+
wordlist;
|
|
947
929
|
/**
|
|
948
930
|
* Transforms hex digests to human-readable strings.
|
|
949
931
|
*
|
|
@@ -1109,7 +1091,7 @@ var arrayToString = (array) => arrayToBuffer(array).toString("hex");
|
|
|
1109
1091
|
// src/json.ts
|
|
1110
1092
|
var MAX_DEPTH = 5;
|
|
1111
1093
|
var LOG_MAX_DEPTH = 7;
|
|
1112
|
-
|
|
1094
|
+
var jsonReplacer = (key, value) => {
|
|
1113
1095
|
if (value !== null && typeof value === "object" && typeof value[inspect2.custom] === "function") {
|
|
1114
1096
|
return value[inspect2.custom]();
|
|
1115
1097
|
}
|
|
@@ -1122,7 +1104,7 @@ function jsonReplacer(key, value) {
|
|
|
1122
1104
|
}
|
|
1123
1105
|
}
|
|
1124
1106
|
return value;
|
|
1125
|
-
}
|
|
1107
|
+
};
|
|
1126
1108
|
var jsonify = (value, depth = 0, visitedObjects = /* @__PURE__ */ new WeakSet()) => {
|
|
1127
1109
|
if (depth > MAX_DEPTH) {
|
|
1128
1110
|
return null;
|
|
@@ -1209,31 +1191,10 @@ var deepMapValues = (value, fn) => {
|
|
|
1209
1191
|
return new DeepMapper(fn).map(value);
|
|
1210
1192
|
};
|
|
1211
1193
|
var DeepMapper = class {
|
|
1194
|
+
_fn;
|
|
1195
|
+
_cyclic = /* @__PURE__ */ new Map();
|
|
1212
1196
|
constructor(_fn) {
|
|
1213
1197
|
this._fn = _fn;
|
|
1214
|
-
this._cyclic = /* @__PURE__ */ new Map();
|
|
1215
|
-
this._recurse = (value) => {
|
|
1216
|
-
if (this._cyclic.has(value)) {
|
|
1217
|
-
return this._cyclic.get(value);
|
|
1218
|
-
}
|
|
1219
|
-
if (Array.isArray(value)) {
|
|
1220
|
-
const res = new Array(value.length);
|
|
1221
|
-
this._cyclic.set(value, res);
|
|
1222
|
-
for (let i = 0; i < value.length; i++) {
|
|
1223
|
-
res[i] = this._map(value[i], i);
|
|
1224
|
-
}
|
|
1225
|
-
return res;
|
|
1226
|
-
} else if (value !== null && typeof value === "object") {
|
|
1227
|
-
const res = {};
|
|
1228
|
-
this._cyclic.set(value, res);
|
|
1229
|
-
for (const key in value) {
|
|
1230
|
-
res[key] = this._map(value[key], key);
|
|
1231
|
-
}
|
|
1232
|
-
return res;
|
|
1233
|
-
} else {
|
|
1234
|
-
return value;
|
|
1235
|
-
}
|
|
1236
|
-
};
|
|
1237
1198
|
}
|
|
1238
1199
|
map(value) {
|
|
1239
1200
|
return this._map(value, void 0);
|
|
@@ -1244,36 +1205,37 @@ var DeepMapper = class {
|
|
|
1244
1205
|
}
|
|
1245
1206
|
return this._fn(value, this._recurse, key);
|
|
1246
1207
|
}
|
|
1208
|
+
_recurse = (value) => {
|
|
1209
|
+
if (this._cyclic.has(value)) {
|
|
1210
|
+
return this._cyclic.get(value);
|
|
1211
|
+
}
|
|
1212
|
+
if (Array.isArray(value)) {
|
|
1213
|
+
const res = new Array(value.length);
|
|
1214
|
+
this._cyclic.set(value, res);
|
|
1215
|
+
for (let i = 0; i < value.length; i++) {
|
|
1216
|
+
res[i] = this._map(value[i], i);
|
|
1217
|
+
}
|
|
1218
|
+
return res;
|
|
1219
|
+
} else if (value !== null && typeof value === "object") {
|
|
1220
|
+
const res = {};
|
|
1221
|
+
this._cyclic.set(value, res);
|
|
1222
|
+
for (const key in value) {
|
|
1223
|
+
res[key] = this._map(value[key], key);
|
|
1224
|
+
}
|
|
1225
|
+
return res;
|
|
1226
|
+
} else {
|
|
1227
|
+
return value;
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1247
1230
|
};
|
|
1248
1231
|
var deepMapValuesAsync = (value, fn) => {
|
|
1249
1232
|
return new DeepMapperAsync(fn).map(value);
|
|
1250
1233
|
};
|
|
1251
1234
|
var DeepMapperAsync = class {
|
|
1235
|
+
_fn;
|
|
1236
|
+
_cyclic = /* @__PURE__ */ new Map();
|
|
1252
1237
|
constructor(_fn) {
|
|
1253
1238
|
this._fn = _fn;
|
|
1254
|
-
this._cyclic = /* @__PURE__ */ new Map();
|
|
1255
|
-
this._recurse = async (value) => {
|
|
1256
|
-
if (this._cyclic.has(value)) {
|
|
1257
|
-
return this._cyclic.get(value);
|
|
1258
|
-
}
|
|
1259
|
-
if (Array.isArray(value)) {
|
|
1260
|
-
const res = new Array(value.length);
|
|
1261
|
-
this._cyclic.set(value, res);
|
|
1262
|
-
for (let i = 0; i < value.length; i++) {
|
|
1263
|
-
res[i] = await this._map(value[i], i);
|
|
1264
|
-
}
|
|
1265
|
-
return res;
|
|
1266
|
-
} else if (value !== null && typeof value === "object") {
|
|
1267
|
-
const res = {};
|
|
1268
|
-
this._cyclic.set(value, res);
|
|
1269
|
-
for (const key in value) {
|
|
1270
|
-
res[key] = await this._map(value[key], key);
|
|
1271
|
-
}
|
|
1272
|
-
return res;
|
|
1273
|
-
} else {
|
|
1274
|
-
return value;
|
|
1275
|
-
}
|
|
1276
|
-
};
|
|
1277
1239
|
}
|
|
1278
1240
|
map(value) {
|
|
1279
1241
|
return this._map(value, void 0);
|
|
@@ -1284,6 +1246,28 @@ var DeepMapperAsync = class {
|
|
|
1284
1246
|
}
|
|
1285
1247
|
return this._fn(value, this._recurse, key);
|
|
1286
1248
|
}
|
|
1249
|
+
_recurse = async (value) => {
|
|
1250
|
+
if (this._cyclic.has(value)) {
|
|
1251
|
+
return this._cyclic.get(value);
|
|
1252
|
+
}
|
|
1253
|
+
if (Array.isArray(value)) {
|
|
1254
|
+
const res = new Array(value.length);
|
|
1255
|
+
this._cyclic.set(value, res);
|
|
1256
|
+
for (let i = 0; i < value.length; i++) {
|
|
1257
|
+
res[i] = await this._map(value[i], i);
|
|
1258
|
+
}
|
|
1259
|
+
return res;
|
|
1260
|
+
} else if (value !== null && typeof value === "object") {
|
|
1261
|
+
const res = {};
|
|
1262
|
+
this._cyclic.set(value, res);
|
|
1263
|
+
for (const key in value) {
|
|
1264
|
+
res[key] = await this._map(value[key], key);
|
|
1265
|
+
}
|
|
1266
|
+
return res;
|
|
1267
|
+
} else {
|
|
1268
|
+
return value;
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1287
1271
|
};
|
|
1288
1272
|
var visitValues = (object, visitor) => {
|
|
1289
1273
|
if (Array.isArray(object)) {
|
|
@@ -1605,7 +1589,7 @@ var safeParseInt = (value, defaultValue) => {
|
|
|
1605
1589
|
try {
|
|
1606
1590
|
const n = parseInt(value ?? "");
|
|
1607
1591
|
return isNaN(n) ? defaultValue : n;
|
|
1608
|
-
} catch
|
|
1592
|
+
} catch {
|
|
1609
1593
|
return defaultValue;
|
|
1610
1594
|
}
|
|
1611
1595
|
};
|
|
@@ -1620,7 +1604,7 @@ var safeParseJson = (data, defaultValue) => {
|
|
|
1620
1604
|
if (data && data.length > 0) {
|
|
1621
1605
|
try {
|
|
1622
1606
|
return JSON.parse(data);
|
|
1623
|
-
} catch
|
|
1607
|
+
} catch {
|
|
1624
1608
|
}
|
|
1625
1609
|
}
|
|
1626
1610
|
return defaultValue;
|
|
@@ -1630,8 +1614,10 @@ var safeParseJson = (data, defaultValue) => {
|
|
|
1630
1614
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1631
1615
|
var __dxlog_file5 = "/__w/dxos/dxos/packages/common/util/src/sliding-window-summary.ts";
|
|
1632
1616
|
var SlidingWindowSummary = class {
|
|
1617
|
+
_buffer;
|
|
1618
|
+
_sum = 0;
|
|
1619
|
+
_precision;
|
|
1633
1620
|
constructor(options) {
|
|
1634
|
-
this._sum = 0;
|
|
1635
1621
|
this._buffer = new CircularBuffer(options.dataPoints);
|
|
1636
1622
|
if (options.precision != null) {
|
|
1637
1623
|
invariant5(options.precision >= 0, void 0, {
|
|
@@ -1711,6 +1697,24 @@ var capitalize = (str) => {
|
|
|
1711
1697
|
}
|
|
1712
1698
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1713
1699
|
};
|
|
1700
|
+
function trim(strings, ...values) {
|
|
1701
|
+
const raw = strings.reduce((out, str, i) => {
|
|
1702
|
+
out += str;
|
|
1703
|
+
if (i < values.length) {
|
|
1704
|
+
const match = str.match(/(^|\n)([ \t]*)$/);
|
|
1705
|
+
const baseIndent = match ? match[2] : "";
|
|
1706
|
+
const val = String(values[i]).replace(/\r?\n/g, "\n" + baseIndent);
|
|
1707
|
+
out += val;
|
|
1708
|
+
}
|
|
1709
|
+
return out;
|
|
1710
|
+
}, "");
|
|
1711
|
+
const lines = raw.split("\n");
|
|
1712
|
+
while (lines.length && !lines[0].trim()) lines.shift();
|
|
1713
|
+
while (lines.length && !lines[lines.length - 1].trim()) lines.pop();
|
|
1714
|
+
const minIndent = Math.min(...lines.filter((l) => l.trim()).map((l) => l.match(/^[ \t]*/)?.[0].length ?? 0));
|
|
1715
|
+
return lines.map((l) => l.slice(minIndent)).join("\n");
|
|
1716
|
+
}
|
|
1717
|
+
var kebabize = (str) => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? "-" : "") + $.toLowerCase());
|
|
1714
1718
|
|
|
1715
1719
|
// src/sum.ts
|
|
1716
1720
|
var sum = (values) => values.reduce((a, b) => a + b, 0);
|
|
@@ -1909,10 +1913,8 @@ var toFallback = (hash) => {
|
|
|
1909
1913
|
|
|
1910
1914
|
// src/tracer.ts
|
|
1911
1915
|
var Tracer = class {
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
this._recording = false;
|
|
1915
|
-
}
|
|
1916
|
+
_events = /* @__PURE__ */ new Map();
|
|
1917
|
+
_recording = false;
|
|
1916
1918
|
// TODO(burdon): Start/stop methods for recording data? By id?
|
|
1917
1919
|
// Alternatively, enable subscriptions to track/compute series.
|
|
1918
1920
|
// TODO(burdon): Hierarchical traces?
|
|
@@ -2013,7 +2015,7 @@ var stringifyTree = (node, ancestors = [], rows = []) => {
|
|
|
2013
2015
|
};
|
|
2014
2016
|
|
|
2015
2017
|
// src/types.ts
|
|
2016
|
-
var
|
|
2018
|
+
var isTruthy = (value) => !!value;
|
|
2017
2019
|
var isNonNullable = (value) => value != null;
|
|
2018
2020
|
var doAsync = async (fn) => fn();
|
|
2019
2021
|
var getProviderValue = (provider, arg) => {
|
|
@@ -2044,6 +2046,70 @@ var arrayMove = (array, from, to) => {
|
|
|
2044
2046
|
return array;
|
|
2045
2047
|
};
|
|
2046
2048
|
|
|
2049
|
+
// src/unit.ts
|
|
2050
|
+
var Formatter = (unit) => {
|
|
2051
|
+
return (n, precision = 2) => {
|
|
2052
|
+
const value = n / unit.quotient;
|
|
2053
|
+
return `${value.toFixed(precision)}${unit.symbol}`;
|
|
2054
|
+
};
|
|
2055
|
+
};
|
|
2056
|
+
var Unit = {
|
|
2057
|
+
// ms.
|
|
2058
|
+
Hour: Formatter({
|
|
2059
|
+
symbol: "h",
|
|
2060
|
+
quotient: 60 * 60 * 1e3
|
|
2061
|
+
}),
|
|
2062
|
+
Minute: Formatter({
|
|
2063
|
+
symbol: "m",
|
|
2064
|
+
quotient: 60 * 1e3
|
|
2065
|
+
}),
|
|
2066
|
+
Second: Formatter({
|
|
2067
|
+
symbol: "s",
|
|
2068
|
+
quotient: 1e3
|
|
2069
|
+
}),
|
|
2070
|
+
Millisecond: Formatter({
|
|
2071
|
+
symbol: "ms",
|
|
2072
|
+
quotient: 1
|
|
2073
|
+
}),
|
|
2074
|
+
Duration: (n) => {
|
|
2075
|
+
const hours = Math.floor(n / (60 * 60 * 1e3));
|
|
2076
|
+
const minutes = Math.floor(n % (60 * 60 * 1e3) / (60 * 1e3));
|
|
2077
|
+
if (hours) {
|
|
2078
|
+
return minutes ? `${hours}h ${minutes}m` : `${hours}h`;
|
|
2079
|
+
}
|
|
2080
|
+
const seconds = Math.floor(n % (60 * 1e3) / 1e3);
|
|
2081
|
+
if (minutes) {
|
|
2082
|
+
return seconds ? `${minutes}m ${seconds}s` : `${minutes}m`;
|
|
2083
|
+
}
|
|
2084
|
+
if (seconds) {
|
|
2085
|
+
return `${(n / 1e3).toFixed(1)}s`;
|
|
2086
|
+
}
|
|
2087
|
+
return `${n}ms`;
|
|
2088
|
+
},
|
|
2089
|
+
// bytes (note KB via KiB).
|
|
2090
|
+
Gigabyte: Formatter({
|
|
2091
|
+
symbol: "GB",
|
|
2092
|
+
quotient: 1e3 * 1e3 * 1e3
|
|
2093
|
+
}),
|
|
2094
|
+
Megabyte: Formatter({
|
|
2095
|
+
symbol: "MB",
|
|
2096
|
+
quotient: 1e3 * 1e3
|
|
2097
|
+
}),
|
|
2098
|
+
Kilobyte: Formatter({
|
|
2099
|
+
symbol: "KB",
|
|
2100
|
+
quotient: 1e3
|
|
2101
|
+
}),
|
|
2102
|
+
// general.
|
|
2103
|
+
Thousand: Formatter({
|
|
2104
|
+
symbol: "k",
|
|
2105
|
+
quotient: 1e3
|
|
2106
|
+
}),
|
|
2107
|
+
Percent: Formatter({
|
|
2108
|
+
symbol: "%",
|
|
2109
|
+
quotient: 1 / 100
|
|
2110
|
+
})
|
|
2111
|
+
};
|
|
2112
|
+
|
|
2047
2113
|
// src/url.ts
|
|
2048
2114
|
var createUrl = (url, search) => {
|
|
2049
2115
|
const base = typeof url === "string" ? new URL(url) : url;
|
|
@@ -2055,11 +2121,11 @@ var createUrl = (url, search) => {
|
|
|
2055
2121
|
|
|
2056
2122
|
// src/weak.ts
|
|
2057
2123
|
var WeakDictionary = class {
|
|
2124
|
+
_internal = /* @__PURE__ */ new Map();
|
|
2125
|
+
_finalization = new FinalizationRegistry((cleanUpCallback) => {
|
|
2126
|
+
cleanUpCallback();
|
|
2127
|
+
});
|
|
2058
2128
|
constructor(entries2) {
|
|
2059
|
-
this._internal = /* @__PURE__ */ new Map();
|
|
2060
|
-
this._finalization = new FinalizationRegistry((cleanUpCallback) => {
|
|
2061
|
-
cleanUpCallback();
|
|
2062
|
-
});
|
|
2063
2129
|
this._internal = new Map(entries2?.map(([key, value]) => [
|
|
2064
2130
|
key,
|
|
2065
2131
|
new WeakRef(value)
|
|
@@ -2158,6 +2224,7 @@ export {
|
|
|
2158
2224
|
MapEntry,
|
|
2159
2225
|
SlidingWindowSummary,
|
|
2160
2226
|
Tracer,
|
|
2227
|
+
Unit,
|
|
2161
2228
|
WeakDictionary,
|
|
2162
2229
|
accessBy,
|
|
2163
2230
|
arrayMove,
|
|
@@ -2200,7 +2267,6 @@ export {
|
|
|
2200
2267
|
getDate,
|
|
2201
2268
|
getDebugName,
|
|
2202
2269
|
getDeep,
|
|
2203
|
-
getFirstTwoRenderableChars,
|
|
2204
2270
|
getHostPlatform,
|
|
2205
2271
|
getPrototypeSpecificInstanceId,
|
|
2206
2272
|
getProviderValue,
|
|
@@ -2218,12 +2284,13 @@ export {
|
|
|
2218
2284
|
iosCheck,
|
|
2219
2285
|
isNode,
|
|
2220
2286
|
isNonNullable,
|
|
2221
|
-
|
|
2287
|
+
isTruthy,
|
|
2222
2288
|
joinTables,
|
|
2223
2289
|
jsonKeyReplacer,
|
|
2224
2290
|
jsonReplacer,
|
|
2225
2291
|
jsonify,
|
|
2226
2292
|
jsonlogify,
|
|
2293
|
+
kebabize,
|
|
2227
2294
|
keyToEmoji,
|
|
2228
2295
|
keyToFallback,
|
|
2229
2296
|
keyToHue,
|
|
@@ -2266,6 +2333,7 @@ export {
|
|
|
2266
2333
|
toFallback,
|
|
2267
2334
|
toHue,
|
|
2268
2335
|
tracer,
|
|
2336
|
+
trim,
|
|
2269
2337
|
visitValues
|
|
2270
2338
|
};
|
|
2271
2339
|
//# sourceMappingURL=index.mjs.map
|