@tamagui/simple-hash
Advanced tools
Comparing version 1.111.8 to 1.111.9
@@ -1,37 +0,40 @@ | ||
var cache = /* @__PURE__ */ new Map(), simpleHash = function(str) { | ||
var hashMin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10; | ||
if (cache.has(str)) | ||
return cache.get(str); | ||
for (var hash = 0, valids = "", added = 0, len = str.length, i = 0; i < len; i++) { | ||
if (hashMin !== "strict" && added <= hashMin) { | ||
var char = str.charCodeAt(i); | ||
if (char === 46) { | ||
valids += "--"; | ||
continue; | ||
var cache = /* @__PURE__ */new Map(), | ||
simpleHash = function (str) { | ||
var hashMin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10; | ||
if (cache.has(str)) return cache.get(str); | ||
for (var hash = 0, valids = "", added = 0, len = str.length, i = 0; i < len; i++) { | ||
if (hashMin !== "strict" && added <= hashMin) { | ||
var char = str.charCodeAt(i); | ||
if (char === 46) { | ||
valids += "--"; | ||
continue; | ||
} | ||
if (isValidCSSCharCode(char)) { | ||
added++, valids += str[i]; | ||
continue; | ||
} | ||
} | ||
if (isValidCSSCharCode(char)) { | ||
added++, valids += str[i]; | ||
continue; | ||
} | ||
hash = hashChar(hash, str[i]); | ||
} | ||
hash = hashChar(hash, str[i]); | ||
} | ||
var res = valids + (hash ? Math.abs(hash) : ""); | ||
return cache.size > 1e4 && cache.clear(), cache.set(str, res), res; | ||
}, hashChar = function(hash, c) { | ||
return Math.imul(31, hash) + c.charCodeAt(0) | 0; | ||
}; | ||
var res = valids + (hash ? Math.abs(hash) : ""); | ||
return cache.size > 1e4 && cache.clear(), cache.set(str, res), res; | ||
}, | ||
hashChar = function (hash, c) { | ||
return Math.imul(31, hash) + c.charCodeAt(0) | 0; | ||
}; | ||
function isValidCSSCharCode(code) { | ||
return ( | ||
// A-Z | ||
code >= 65 && code <= 90 || // a-z | ||
code >= 97 && code <= 122 || // _ | ||
code === 95 || // - | ||
code === 45 || // 0-9 | ||
code >= 65 && code <= 90 || | ||
// a-z | ||
code >= 97 && code <= 122 || | ||
// _ | ||
code === 95 || | ||
// - | ||
code === 45 || | ||
// 0-9 | ||
code >= 48 && code <= 57 | ||
); | ||
} | ||
export { | ||
simpleHash | ||
}; | ||
//# sourceMappingURL=index.js.map | ||
export { simpleHash }; | ||
//# sourceMappingURL=index.native.js.map |
{ | ||
"name": "@tamagui/simple-hash", | ||
"version": "1.111.8", | ||
"version": "1.111.9", | ||
"sideEffects": false, | ||
@@ -24,3 +24,3 @@ "types": "./types/index.d.ts", | ||
".": { | ||
"react-native-import": "./dist/esm/index.native.mjs", | ||
"react-native-import": "./dist/esm/index.native.js", | ||
"react-native": "./dist/cjs/index.native.js", | ||
@@ -33,3 +33,3 @@ "types": "./types/index.d.ts", | ||
"devDependencies": { | ||
"@tamagui/build": "1.111.8" | ||
"@tamagui/build": "1.111.9" | ||
}, | ||
@@ -36,0 +36,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16435
15
274