Socket
Book a DemoInstallSign in
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

to
0.0.3

19

index.js

@@ -30,4 +30,4 @@ 'use strict';

},
raw: {
value() {
rawKeys: {
get() {
const keys = [];

@@ -46,5 +46,4 @@ for (let i = 0; i < storage.length; i += 1) {

get() {
return this.raw().map(key =>
key.replace(new RegExp(`^${namespace}.`), '')
);
return this.rawKeys.map(key =>
key.replace(new RegExp(`^${namespace}.`), ''));
}

@@ -67,6 +66,12 @@ },

},
stringify: {
enumerable: true,
value(replacer, space) {
return JSON.stringify(this.valueOf(), replacer, space);
}
},
size: {
enumerable: true,
get() {
return this.raw().length;
return this.rawKeys.length;
}

@@ -83,3 +88,3 @@ },

value() {
this.keys.forEach(key => {
this.rawKeys.forEach(key => {
storage.removeItem(key);

@@ -86,0 +91,0 @@ });

{
"name": "pet-shop",
"version": "0.0.2",
"version": "0.0.3",
"description": "A simple wrapper of Web Storage API",
"main": "index.js",
"license": "MIT",

@@ -11,5 +10,11 @@ "author": {

},
"engines": {
"node": ">=8.3.0"
},
"keywords": [
"cache",
"config",
"data",
"localStorage",
"sessionStorage",
"storage",
"store"
],
"repository": {

@@ -20,11 +25,6 @@ "type": "git",

},
"keywords": [
"data",
"cache",
"store",
"config",
"storage",
"localStorage",
"sessionStorage"
]
"main": "index.js",
"engines": {
"node": ">=8.3.0"
}
}

@@ -20,1 +20,19 @@ # pet-shop

```
Usage
```js
const store = PetShop({
namespace: 'pet-shop',
storage: localStorage
});
store.set('abc', 'xyz');
store.get('abc'); // output: 'xyz'
store.size; // output: 0
localStorage.getItem('pet-shop.abc'); // output: 'xyz'
store.remove('abc');
store.has('abc'); // output: false
```
SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.