New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@statsig/client-core

Package Overview
Dependencies
Maintainers
4
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@statsig/client-core - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "@statsig/client-core",
"version": "1.0.0",
"version": "1.0.1",
"dependencies": {},

@@ -5,0 +5,0 @@ "type": "commonjs",

@@ -6,11 +6,12 @@ "use strict";

function _getUserStorageKey(sdkKey, user, customKeyGenerator) {
var _a, _b;
var _a;
if (customKeyGenerator) {
return customKeyGenerator(sdkKey, user);
}
const cids = user && user.customIDs ? user.customIDs : {};
const parts = [
`uid:${(_a = user === null || user === void 0 ? void 0 : user.userID) !== null && _a !== void 0 ? _a : ''}`,
`cids:${Object.entries((_b = user === null || user === void 0 ? void 0 : user.customIDs) !== null && _b !== void 0 ? _b : {})
.sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey))
.map(([key, value]) => `${key}-${value}`)
`cids:${Object.keys(cids)
.sort((leftKey, rightKey) => leftKey.localeCompare(rightKey))
.map((key) => `${key}-${cids[key]}`)
.join(',')}`,

@@ -17,0 +18,0 @@ `k:${sdkKey}`,

@@ -138,12 +138,7 @@ "use strict";

lastModifiedTimeMap[cacheKey] = Date.now();
const entries = Object.entries(lastModifiedTimeMap);
if (entries.length <= CACHE_LIMIT) {
yield (0, StorageProvider_1._setObjectInStorage)(this._lastModifiedStoreKey, lastModifiedTimeMap);
return;
const evictable = _getEvictableKey(lastModifiedTimeMap, CACHE_LIMIT);
if (evictable) {
delete lastModifiedTimeMap[evictable];
yield StorageProvider_1.Storage._removeItem(evictable);
}
const oldest = entries.reduce((acc, current) => {
return current[1] < acc[1] ? current : acc;
});
delete lastModifiedTimeMap[oldest[0]];
yield StorageProvider_1.Storage._removeItem(oldest[0]);
yield (0, StorageProvider_1._setObjectInStorage)(this._lastModifiedStoreKey, lastModifiedTimeMap);

@@ -179,11 +174,6 @@ });

add(cacheKey, value) {
const entries = Object.entries(this._data);
if (entries.length < CACHE_LIMIT) {
this._data[cacheKey] = value;
return;
const oldest = _getEvictableKey(this._data, CACHE_LIMIT - 1);
if (oldest) {
delete this._data[oldest];
}
const [oldest] = entries.reduce((acc, curr) => {
return curr[1] < acc[1] ? curr : acc;
});
delete this._data[oldest];
this._data[cacheKey] = value;

@@ -195,1 +185,15 @@ }

}
function _getEvictableKey(data, limit) {
const keys = Object.keys(data);
if (keys.length <= limit) {
return null;
}
return keys.reduce((prevKey, currKey) => {
const prev = data[prevKey];
const current = data[currKey];
if (typeof prev === 'object' && typeof current === 'object') {
return current.receivedAt < prev.receivedAt ? currKey : prevKey;
}
return current < prev ? currKey : prevKey;
});
}

@@ -127,5 +127,5 @@ "use strict";

const params = Object.assign({ [NetworkConfig_1.NetworkParam.SdkKey]: args.sdkKey, [NetworkConfig_1.NetworkParam.SdkType]: SDKType_1.SDKType._get(args.sdkKey), [NetworkConfig_1.NetworkParam.SdkVersion]: StatsigMetadata_1.SDK_VERSION, [NetworkConfig_1.NetworkParam.Time]: String(Date.now()), [NetworkConfig_1.NetworkParam.SessionID]: yield SessionID_1.SessionID.get(args.sdkKey) }, args.params);
const query = Object.entries(params)
.map(([key, value]) => {
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
const query = Object.keys(params)
.map((key) => {
return `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`;
})

@@ -132,0 +132,0 @@ .join('&');

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

export declare const SDK_VERSION = "1.0.0";
export declare const SDK_VERSION = "1.0.1";
export type StatsigMetadata = {

@@ -3,0 +3,0 @@ readonly [key: string]: string | undefined;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StatsigMetadataProvider = exports.SDK_VERSION = void 0;
exports.SDK_VERSION = '1.0.0';
exports.SDK_VERSION = '1.0.1';
let metadata = {

@@ -6,0 +6,0 @@ sdkVersion: exports.SDK_VERSION,

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