@dxos/util 0.8.4-main.e99c46d → 0.8.4-main.ead640a
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 +4 -30
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +4 -30
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +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 +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/string.d.ts +4 -0
- package/dist/types/src/string.d.ts.map +1 -1
- package/dist/types/src/to-fallback.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -2
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/index.ts +0 -1
- package/src/string.ts +7 -0
- package/src/to-fallback.ts +5 -4
- package/src/types.ts +1 -2
- 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
|
@@ -784,33 +784,6 @@ var MapEntry = class {
|
|
|
784
784
|
}
|
|
785
785
|
};
|
|
786
786
|
|
|
787
|
-
// src/first-two-chars.ts
|
|
788
|
-
var renderableCharRegex = /^(?![\p{Control}\p{Mark}\p{Separator}\p{Surrogate}\p{Unassigned}\p{P}])[\p{L}\p{N}\p{S}\p{Emoji}]$/u;
|
|
789
|
-
var getFirstTwoRenderableChars = (label) => {
|
|
790
|
-
const characters = Array.from(label);
|
|
791
|
-
const result = [
|
|
792
|
-
"",
|
|
793
|
-
""
|
|
794
|
-
];
|
|
795
|
-
let foundFirst = false;
|
|
796
|
-
for (let i = 0; i < characters.length; i++) {
|
|
797
|
-
const char = characters[i];
|
|
798
|
-
if (renderableCharRegex.test(char)) {
|
|
799
|
-
if (!foundFirst) {
|
|
800
|
-
result[0] = char;
|
|
801
|
-
foundFirst = true;
|
|
802
|
-
} else {
|
|
803
|
-
const textBetween = characters.slice(result[0].length, i).join("");
|
|
804
|
-
if (/[^\p{L}\p{N}_]/u.test(textBetween)) {
|
|
805
|
-
result[1] = char;
|
|
806
|
-
break;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
return result;
|
|
812
|
-
};
|
|
813
|
-
|
|
814
787
|
// src/for-each-async.ts
|
|
815
788
|
var forEachAsync = (items, fn) => Promise.all(items.map(fn));
|
|
816
789
|
|
|
@@ -1909,6 +1882,7 @@ function trim(strings, ...values) {
|
|
|
1909
1882
|
const minIndent = Math.min(...lines.filter((l) => l.trim()).map((l) => l.match(/^[ \t]*/)?.[0].length ?? 0));
|
|
1910
1883
|
return lines.map((l) => l.slice(minIndent)).join("\n");
|
|
1911
1884
|
}
|
|
1885
|
+
var kebabize = (str) => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? "-" : "") + $.toLowerCase());
|
|
1912
1886
|
|
|
1913
1887
|
// src/sum.ts
|
|
1914
1888
|
var sum = (values) => values.reduce((a, b) => a + b, 0);
|
|
@@ -2224,7 +2198,7 @@ var stringifyTree = (node, ancestors = [], rows = []) => {
|
|
|
2224
2198
|
};
|
|
2225
2199
|
|
|
2226
2200
|
// src/types.ts
|
|
2227
|
-
var
|
|
2201
|
+
var isTruthy = (value) => !!value;
|
|
2228
2202
|
var isNonNullable = (value) => value != null;
|
|
2229
2203
|
var doAsync = async (fn) => fn();
|
|
2230
2204
|
var getProviderValue = (provider, arg) => {
|
|
@@ -2489,7 +2463,6 @@ export {
|
|
|
2489
2463
|
getDate,
|
|
2490
2464
|
getDebugName,
|
|
2491
2465
|
getDeep,
|
|
2492
|
-
getFirstTwoRenderableChars,
|
|
2493
2466
|
getHostPlatform,
|
|
2494
2467
|
getPrototypeSpecificInstanceId,
|
|
2495
2468
|
getProviderValue,
|
|
@@ -2507,12 +2480,13 @@ export {
|
|
|
2507
2480
|
iosCheck,
|
|
2508
2481
|
isNode,
|
|
2509
2482
|
isNonNullable,
|
|
2510
|
-
|
|
2483
|
+
isTruthy,
|
|
2511
2484
|
joinTables,
|
|
2512
2485
|
jsonKeyReplacer,
|
|
2513
2486
|
jsonReplacer,
|
|
2514
2487
|
jsonify,
|
|
2515
2488
|
jsonlogify,
|
|
2489
|
+
kebabize,
|
|
2516
2490
|
keyToEmoji,
|
|
2517
2491
|
keyToFallback,
|
|
2518
2492
|
keyToHue,
|