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

pet-shop

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pet-shop - npm Package Compare versions

Comparing version 0.1.4 to 0.2.0

LICENSE

59

index.js

@@ -120,15 +120,52 @@ // @ts-nocheck

export function smart(store, key) {
return {
get() {
return store.get(key);
},
set(value) {
if (value !== null && value !== undefined) {
store.set(key, value);
} else {
export function createProxy(store) {
return new Proxy(
{},
{
get(_, key) {
return store.get(key);
},
async set(_, key, value) {
if (value !== null && value !== undefined) {
store.set(key, value);
} else {
store.remove(key);
}
return true;
},
async deleteProperty(_, key) {
store.remove(key);
}
return true;
},
},
};
);
}
export function createCache(storage, keys) {
return Object.defineProperties(
{
clear() {
storage.clear();
},
},
Object.fromEntries(
keys.map((key) => [
key,
{
get() {
return storage.get(key);
},
set(value) {
if (value || value === 0 || value === false) {
storage.set(key, value);
} else {
storage.remove(key);
}
},
},
]),
),
);
}

8

package.json
{
"name": "pet-shop",
"version": "0.1.4",
"version": "0.2.0",
"description": "A simple wrapper of Web Storage API",
"license": "MIT",
"author": {
"name": "Eric Chen",
"email": "airkro@qq.com"
},
"keywords": [

@@ -36,2 +32,2 @@ "cache",

}
}
}
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