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

pet-shop

Package Overview
Dependencies
Maintainers
1
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.2 to 0.1.3

26

index.js

@@ -25,7 +25,9 @@ // @ts-nocheck

const raw = storage.getItem(`${namespace}.${key}`);
return raw !== null ? safeParse(raw) : undefined;
return raw === null ? undefined : safeParse(raw);
}
: function get(key) {
const raw = storage.getItem(`${namespace}.${key}`);
return raw !== null ? raw : undefined;
return raw === null ? undefined : raw;
},

@@ -50,2 +52,3 @@ },

}
storage.setItem(`${namespace}.${key}`, value);

@@ -64,4 +67,6 @@ }

const keys = [];
for (let i = 0; i < storage.length; i += 1) {
const key = storage.key(i);
if (key.startsWith(`${namespace}.`)) {

@@ -71,2 +76,3 @@ keys.push(key);

}
return keys;

@@ -92,3 +98,2 @@ },

value: function valueOf() {
// eslint-disable-next-line unicorn/prefer-object-from-entries
return this.keys.reduce(

@@ -123,1 +128,16 @@ (io, key) => ({ [key]: this.get(key), ...io }),

}
export function smart(store, key) {
return {
get() {
return store.get(key);
},
set(value) {
if (value !== null && value !== undefined) {
store.set(key, value);
} else {
store.remove(key);
}
},
};
}

10

package.json
{
"name": "pet-shop",
"version": "0.1.2",
"version": "0.1.3",
"description": "A simple wrapper of Web Storage API",

@@ -31,3 +31,7 @@ "license": "MIT",

"main": "index.js",
"type": "module"
}
"type": "module",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
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