@ztimson/utils 0.23.5 → 0.23.7
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/color.d.ts +6 -0
- package/dist/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -528,6 +528,13 @@ class Cache {
|
|
|
528
528
|
return this;
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
|
+
function blackOrWhite(background) {
|
|
532
|
+
const exploded = background.match(background.length >= 6 ? /\w\w/g : /\w/g);
|
|
533
|
+
if (!exploded) return "black";
|
|
534
|
+
const [r2, g, b2] = exploded.map((hex) => parseInt(hex, 16));
|
|
535
|
+
const luminance = (0.299 * r2 + 0.587 * g + 0.114 * b2) / 255;
|
|
536
|
+
return luminance > 0.5 ? "black" : "white";
|
|
537
|
+
}
|
|
531
538
|
const LETTER_LIST = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
532
539
|
const NUMBER_LIST = "0123456789";
|
|
533
540
|
const SYMBOL_LIST = "~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/";
|
|
@@ -1365,7 +1372,7 @@ class PathEvent {
|
|
|
1365
1372
|
const parsedFind = makeArray(filter).map((pe) => new PathEvent(pe));
|
|
1366
1373
|
return parsedTarget.filter((t) => {
|
|
1367
1374
|
if (!t.fullPath && t.all) return true;
|
|
1368
|
-
return !!parsedFind.find((f) =>
|
|
1375
|
+
return !!parsedFind.find((f) => f.fullPath.startsWith(t.fullPath) && (f.all || t.all || t.methods.intersection(f.methods).length));
|
|
1369
1376
|
});
|
|
1370
1377
|
}
|
|
1371
1378
|
/**
|
|
@@ -1692,6 +1699,7 @@ export {
|
|
|
1692
1699
|
addUnique,
|
|
1693
1700
|
adjustedInterval,
|
|
1694
1701
|
arrayDiff,
|
|
1702
|
+
blackOrWhite,
|
|
1695
1703
|
caseInsensitiveSort,
|
|
1696
1704
|
clean,
|
|
1697
1705
|
dec2Frac,
|