@tamagui/simple-hash 1.27.2 → 1.28.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/dist/esm/index.mjs +0 -42
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/simple-hash",
3
- "version": "1.27.2",
3
+ "version": "1.28.0",
4
4
  "sideEffects": false,
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
@@ -25,7 +25,7 @@
25
25
  }
26
26
  },
27
27
  "devDependencies": {
28
- "@tamagui/build": "1.27.2"
28
+ "@tamagui/build": "1.28.0"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"
@@ -1,42 +0,0 @@
1
- const cache = /* @__PURE__ */ new Map();
2
- const simpleHash = (str, hashMin = 10) => {
3
- if (cache.has(str)) {
4
- return cache.get(str);
5
- }
6
- let hash = 0;
7
- let valids = "";
8
- const len = str.length;
9
- for (let i = 0; i < len; i++) {
10
- const char = str.charCodeAt(i);
11
- if (char === 46) {
12
- valids += "d0t";
13
- }
14
- if (isValidCSSCharCode(char) && len <= hashMin) {
15
- valids += str[i];
16
- } else {
17
- hash = (hash << 5) - hash + char;
18
- hash &= hash;
19
- }
20
- }
21
- const res = valids + (hash ? new Uint32Array([hash])[0].toString(36) : "");
22
- if (cache.size > 1e4) {
23
- cache.clear();
24
- }
25
- cache.set(str, res);
26
- return res;
27
- };
28
- function isValidCSSCharCode(code) {
29
- return (
30
- // A-Z
31
- code >= 65 && code <= 90 || // a-z
32
- code >= 97 && code <= 122 || // _
33
- code === 95 || // -
34
- code === 45 || // 0-9
35
- code >= 48 && code <= 57
36
- );
37
- }
38
- export {
39
- isValidCSSCharCode,
40
- simpleHash
41
- };
42
- //# sourceMappingURL=index.mjs.map