@rozenite/storage-plugin 1.9.0 → 1.10.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.
@@ -1,17 +0,0 @@
1
- // This is a heuristic to determine if a string is garbled.
2
- export const looksLikeGarbled = (str: string): boolean => {
3
- // 1. Check for replacement character (�)
4
- if (str.includes('\uFFFD')) return true;
5
-
6
- // 2. Check for unusual control characters
7
- // eslint-disable-next-line no-control-regex
8
- const controlChars = /[\u0000-\u001F\u007F-\u009F]/;
9
- if (controlChars.test(str)) return true;
10
-
11
- // 3. Optionally, check if most chars are non-printable
12
- const printableRatio =
13
- [...str].filter((c) => c >= ' ' && c <= '~').length / str.length;
14
- if (printableRatio < 0.7) return true; // mostly non-printable → probably binary
15
-
16
- return false; // seems like valid string
17
- };