You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

localstorage-enhance

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localstorage-enhance - npm Package Compare versions

Comparing version

to
1.0.5

14

dist/index.js

@@ -301,3 +301,7 @@ var __defProp = Object.defineProperty;

__publicField(this, "setItem", ({ key, data, maxAge = 0, namespace = "default" }) => {
this.memoryData.set(`${namespace}|${key}`, { data, time: Date.now(), maxAge });
this.memoryData.set(`${namespace}|${key}`, {
data,
time: Date.now(),
maxAge
});
this.syncMemoryToStorageIdle();

@@ -308,3 +312,7 @@ return this;

dataObjs.forEach(({ key, data, maxAge = 0, namespace = "default" }) => {
this.memoryData.set(`${namespace}|${key}`, { data, time: Date.now(), maxAge });
this.memoryData.set(`${namespace}|${key}`, {
data,
time: Date.now(),
maxAge
});
});

@@ -414,3 +422,3 @@ this.syncMemoryToStorageIdle();

__publicField(this, "syncMemoryToStorageIdle", debounce(() => {
window.requestIdleCallback(() => this.syncMemoryToStorage());
setTimeout(() => this.syncMemoryToStorage());
}, 100));

@@ -417,0 +425,0 @@ this.storageKey = storageKey != null ? storageKey : "localStorage_enhance";

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

import LRUCache from './LRUCache';
import LRUCache from "./LRUCache";
declare type Data = string | number | boolean | undefined | null | object;

@@ -13,3 +13,3 @@ interface DataObj {

memoryData: LRUCache<DataObj>;
constructor({ storageKey, capacity, encrypt }: {
constructor({ storageKey, capacity, encrypt, }: {
storageKey: string;

@@ -19,3 +19,3 @@ capacity?: number;

});
setItem: ({ key, data, maxAge, namespace }: {
setItem: ({ key, data, maxAge, namespace, }: {
key: string;

@@ -22,0 +22,0 @@ data: Data;

{
"name": "localstorage-enhance",
"description": "Enhanced version of localStorage",
"version": "1.0.4",
"version": "1.0.5",
"type": "module",

@@ -6,0 +6,0 @@ "main": "dist/index.js",