@tamagui/simple-hash
Advanced tools
Comparing version 1.113.1 to 1.113.2
@@ -1,43 +0,39 @@ | ||
var cache = /* @__PURE__ */new Map(), | ||
cacheSize = 0, | ||
simpleHash = function (strIn) { | ||
var hashMin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10; | ||
if (cache.has(strIn)) return cache.get(strIn); | ||
var str = strIn; | ||
str[0] === "v" && str.startsWith("var(") && (str = str.slice(6, str.length - 1)); | ||
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; | ||
} | ||
var cache = /* @__PURE__ */ new Map(), cacheSize = 0, simpleHash = function(strIn) { | ||
var hashMin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10; | ||
if (cache.has(strIn)) | ||
return cache.get(strIn); | ||
var str = strIn; | ||
str[0] === "v" && str.startsWith("var(") && (str = str.slice(6, str.length - 1)); | ||
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; | ||
} | ||
hash = hashChar(hash, str[i]); | ||
if (isValidCSSCharCode(char)) { | ||
added++, valids += str[i]; | ||
continue; | ||
} | ||
} | ||
var res = valids + (hash ? Math.abs(hash) : ""); | ||
return cacheSize > 1e4 && (cache.clear(), cacheSize = 0), cache.set(strIn, res), cacheSize++, res; | ||
}, | ||
hashChar = function (hash, c) { | ||
return Math.imul(31, hash) + c.charCodeAt(0) | 0; | ||
}; | ||
hash = hashChar(hash, str[i]); | ||
} | ||
var res = valids + (hash ? Math.abs(hash) : ""); | ||
return cacheSize > 1e4 && (cache.clear(), cacheSize = 0), cache.set(strIn, res), cacheSize++, 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.native.js.map | ||
export { | ||
simpleHash | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@tamagui/simple-hash", | ||
"version": "1.113.1", | ||
"version": "1.113.2", | ||
"sideEffects": false, | ||
@@ -32,3 +32,3 @@ "types": "./types/index.d.ts", | ||
"devDependencies": { | ||
"@tamagui/build": "1.113.1" | ||
"@tamagui/build": "1.113.2" | ||
}, | ||
@@ -35,0 +35,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
17985
294