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

@jmondi/browser-storage

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jmondi/browser-storage - npm Package Compare versions

Comparing version 1.8.0 to 1.8.1

8

esm/index.d.ts

@@ -60,6 +60,11 @@ export type Serializer = {

readonly adapter: AsyncAdapter<SetConfig>;
readonly cachedAdapter: MemoryStorageAdapter;
readonly prefix: string;
readonly serializer: Serializer;
constructor(config: AsyncStorageConfig);
clear(): void;
syncCache(): Promise<void>;
getCache(key: string): string | null;
setCache(key: string, value?: string): void;
removeCache(key: string): void;
clear(): Promise<void>;
get<T>(key: string): Promise<T | null>;

@@ -79,2 +84,3 @@ set(key: string, value?: unknown, config?: SetConfig): Promise<boolean>;

private storage;
entries(): IterableIterator<[string, string]>;
clear(): void;

@@ -81,0 +87,0 @@ getItem(key: string): string | null;

@@ -93,2 +93,8 @@ export class AbstractBrowserStorage {

});
Object.defineProperty(this, "cachedAdapter", {
enumerable: true,
configurable: true,
writable: true,
value: new MemoryStorageAdapter()
});
Object.defineProperty(this, "prefix", {

@@ -110,5 +116,20 @@ enumerable: true,

}
clear() {
this.adapter.clear?.();
async syncCache() {
for (let [key, value] of this.cachedAdapter.entries()) {
await this.adapter.setItem(key, value);
}
}
getCache(key) {
return this.cachedAdapter.getItem(key);
}
setCache(key, value) {
if (value)
this.cachedAdapter.setItem(key, value);
}
removeCache(key) {
this.cachedAdapter.removeItem(key);
}
async clear() {
await this.adapter.clear?.();
}
async get(key) {

@@ -178,2 +199,5 @@ return this.fromStore(await this.adapter.getItem(this.prefix + key));

}
entries() {
return this.storage.entries();
}
clear() {

@@ -180,0 +204,0 @@ this.storage.clear();

2

package.json

@@ -5,3 +5,3 @@ {

"name": "@jmondi/browser-storage",
"version": "1.8.0",
"version": "1.8.1",
"description": "Utilities for local and session browser storage.",

@@ -8,0 +8,0 @@ "keywords": [

@@ -60,6 +60,11 @@ export type Serializer = {

readonly adapter: AsyncAdapter<SetConfig>;
readonly cachedAdapter: MemoryStorageAdapter;
readonly prefix: string;
readonly serializer: Serializer;
constructor(config: AsyncStorageConfig);
clear(): void;
syncCache(): Promise<void>;
getCache(key: string): string | null;
setCache(key: string, value?: string): void;
removeCache(key: string): void;
clear(): Promise<void>;
get<T>(key: string): Promise<T | null>;

@@ -79,2 +84,3 @@ set(key: string, value?: unknown, config?: SetConfig): Promise<boolean>;

private storage;
entries(): IterableIterator<[string, string]>;
clear(): void;

@@ -81,0 +87,0 @@ getItem(key: string): string | null;

@@ -98,2 +98,8 @@ "use strict";

});
Object.defineProperty(this, "cachedAdapter", {
enumerable: true,
configurable: true,
writable: true,
value: new MemoryStorageAdapter()
});
Object.defineProperty(this, "prefix", {

@@ -115,5 +121,20 @@ enumerable: true,

}
clear() {
this.adapter.clear?.();
async syncCache() {
for (let [key, value] of this.cachedAdapter.entries()) {
await this.adapter.setItem(key, value);
}
}
getCache(key) {
return this.cachedAdapter.getItem(key);
}
setCache(key, value) {
if (value)
this.cachedAdapter.setItem(key, value);
}
removeCache(key) {
this.cachedAdapter.removeItem(key);
}
async clear() {
await this.adapter.clear?.();
}
async get(key) {

@@ -186,2 +207,5 @@ return this.fromStore(await this.adapter.getItem(this.prefix + key));

}
entries() {
return this.storage.entries();
}
clear() {

@@ -188,0 +212,0 @@ this.storage.clear();

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