Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tamagui/simple-hash

Package Overview
Dependencies
Maintainers
0
Versions
963
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tamagui/simple-hash - npm Package Compare versions

Comparing version 1.112.8 to 1.112.9

11

dist/cjs/index.js

@@ -20,5 +20,8 @@ var __defProp = Object.defineProperty;

module.exports = __toCommonJS(src_exports);
const cache = /* @__PURE__ */ new Map(), simpleHash = (str, hashMin = 10) => {
if (cache.has(str))
return cache.get(str);
const cache = /* @__PURE__ */ new Map();
let cacheSize = 0;
const simpleHash = (strIn, hashMin = 10) => {
if (cache.has(strIn))
return cache.get(strIn);
let str = strIn;
str[0] === "v" && str.startsWith("var(") && (str = str.slice(6, str.length - 1));

@@ -42,3 +45,3 @@ let hash = 0, valids = "", added = 0;

const res = valids + (hash ? Math.abs(hash) : "");
return cache.size > 1e4 && cache.clear(), cache.set(str, res), res;
return cacheSize > 1e4 && (cache.clear(), cacheSize = 0), cache.set(strIn, res), cacheSize++, res;
}, hashChar = (hash, c) => Math.imul(31, hash) + c.charCodeAt(0) | 0;

@@ -45,0 +48,0 @@ function isValidCSSCharCode(code) {

@@ -21,6 +21,7 @@ "use strict";

module.exports = __toCommonJS(src_exports);
var cache = /* @__PURE__ */ new Map(), simpleHash = function(str) {
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(str))
return cache.get(str);
if (cache.has(strIn))
return cache.get(strIn);
var str = strIn;
str[0] === "v" && str.startsWith("var(") && (str = str.slice(6, str.length - 1));

@@ -42,3 +43,3 @@ for (var hash = 0, valids = "", added = 0, len = str.length, i = 0; i < len; i++) {

var res = valids + (hash ? Math.abs(hash) : "");
return cache.size > 1e4 && cache.clear(), cache.set(str, res), res;
return cacheSize > 1e4 && (cache.clear(), cacheSize = 0), cache.set(strIn, res), cacheSize++, res;
}, hashChar = function(hash, c) {

@@ -45,0 +46,0 @@ return Math.imul(31, hash) + c.charCodeAt(0) | 0;

@@ -1,4 +0,7 @@

const cache = /* @__PURE__ */ new Map(), simpleHash = (str, hashMin = 10) => {
if (cache.has(str))
return cache.get(str);
const cache = /* @__PURE__ */ new Map();
let cacheSize = 0;
const simpleHash = (strIn, hashMin = 10) => {
if (cache.has(strIn))
return cache.get(strIn);
let str = strIn;
str[0] === "v" && str.startsWith("var(") && (str = str.slice(6, str.length - 1));

@@ -22,3 +25,3 @@ let hash = 0, valids = "", added = 0;

const res = valids + (hash ? Math.abs(hash) : "");
return cache.size > 1e4 && cache.clear(), cache.set(str, res), res;
return cacheSize > 1e4 && (cache.clear(), cacheSize = 0), cache.set(strIn, res), cacheSize++, res;
}, hashChar = (hash, c) => Math.imul(31, hash) + c.charCodeAt(0) | 0;

@@ -25,0 +28,0 @@ function isValidCSSCharCode(code) {

var cache = /* @__PURE__ */new Map(),
simpleHash = function (str) {
cacheSize = 0,
simpleHash = function (strIn) {
var hashMin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10;
if (cache.has(str)) return cache.get(str);
if (cache.has(strIn)) return cache.get(strIn);
var str = strIn;
str[0] === "v" && str.startsWith("var(") && (str = str.slice(6, str.length - 1));

@@ -21,3 +23,3 @@ for (var hash = 0, valids = "", added = 0, len = str.length, i = 0; i < len; i++) {

var res = valids + (hash ? Math.abs(hash) : "");
return cache.size > 1e4 && cache.clear(), cache.set(str, res), res;
return cacheSize > 1e4 && (cache.clear(), cacheSize = 0), cache.set(strIn, res), cacheSize++, res;
},

@@ -24,0 +26,0 @@ hashChar = function (hash, c) {

{
"name": "@tamagui/simple-hash",
"version": "1.112.8",
"version": "1.112.9",
"sideEffects": false,

@@ -32,3 +32,3 @@ "types": "./types/index.d.ts",

"devDependencies": {
"@tamagui/build": "1.112.8"
"@tamagui/build": "1.112.9"
},

@@ -35,0 +35,0 @@ "publishConfig": {

const cache = new Map()
let cacheSize = 0
export const simpleHash = (str: string, hashMin: number | 'strict' = 10) => {
if (cache.has(str)) {
return cache.get(str)
export const simpleHash = (strIn: string, hashMin: number | 'strict' = 10) => {
if (cache.has(strIn)) {
return cache.get(strIn)
}
let str = strIn
// remove var()

@@ -36,7 +39,10 @@ if (str[0] === 'v' && str.startsWith('var(')) {

if (cache.size > 10_000) {
if (cacheSize > 10_000) {
cache.clear()
cacheSize = 0
}
cache.set(str, res)
cache.set(strIn, res)
cacheSize++
return res

@@ -43,0 +49,0 @@ }

@@ -1,2 +0,2 @@

export declare const simpleHash: (str: string, hashMin?: number | "strict") => any;
export declare const simpleHash: (strIn: string, hashMin?: number | "strict") => any;
//# sourceMappingURL=index.d.ts.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc