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

@xinferai/utils-lib

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xinferai/utils-lib - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

2

dist/browser/index.d.ts

@@ -250,3 +250,3 @@ /**

/**
* getUUID - Get a UUID from the cache or generate a new one
* getUUID - Get a UUID
*

@@ -253,0 +253,0 @@ * @returns {string} - A UUID

@@ -963,47 +963,5 @@ "use strict";

// src/get-uuid.ts
var UUIDCache = class {
/**
* @param {number} cacheSize - The maximum number of UUIDs to cache
* @param {number} lowWaterMark - The minimum number of UUIDs to keep in the cache
*/
constructor(cacheSize = 666, lowWaterMark = Math.floor(cacheSize * 0.2)) {
this.cacheSize = cacheSize;
this.lowWaterMark = lowWaterMark;
this.cache = [];
this.isGenerating = false;
this.fillCache();
}
getUUID() {
if (this.cache.length <= this.lowWaterMark) {
this.fillCache();
}
return this.cache.pop() || v4_default();
}
// For testing/monitoring
getCacheSize() {
return this.cache.length;
}
fillCache() {
if (this.isGenerating) return;
this.isGenerating = true;
const generateBatch = () => {
const batchSize = 33;
let generated = 0;
while (generated < batchSize && this.cache.length < this.cacheSize) {
this.cache.push(v4_default());
generated++;
}
if (this.cache.length < this.cacheSize) {
setTimeout(generateBatch, 0);
} else {
this.isGenerating = false;
}
};
setTimeout(generateBatch, 0);
}
};
var uuidCache = new UUIDCache();
// src/get-uuid-browser.ts
var getUUID = () => {
return uuidCache.getUUID();
return v4_default();
};

@@ -1010,0 +968,0 @@

@@ -994,3 +994,3 @@ "use strict";

// src/get-uuid.ts
// src/get-uuid-node.ts
var UUIDCache = class {

@@ -997,0 +997,0 @@ /**

{
"name": "@xinferai/utils-lib",
"version": "1.0.7",
"version": "1.0.8",
"exports": {

@@ -5,0 +5,0 @@ ".": {

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