Comparing version 0.0.0 to 0.0.1
19
index.js
@@ -26,2 +26,21 @@ 'use strict'; | ||
} | ||
}, | ||
keys: { | ||
value() { | ||
const keys = []; | ||
for (let i = 0; i < storage.length; i += 1) { | ||
const key = storage.key(i); | ||
if (key.startsWith(`${namespace}.`)) { | ||
keys.push(key); | ||
} | ||
} | ||
return keys; | ||
} | ||
}, | ||
clear: { | ||
value() { | ||
this.keys().forEach(key => { | ||
storage.removeItem(key); | ||
}); | ||
} | ||
} | ||
@@ -28,0 +47,0 @@ } |
{ | ||
"name": "pet-shop", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "A simple wrapper of Web Storage API", | ||
"main": "index.js", | ||
"license": "MIT" | ||
"license": "MIT", | ||
"author": { | ||
"name": "Eric Chen", | ||
"email": "airkro@qq.com" | ||
}, | ||
"engines": { | ||
"node": ">=6.0.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/airkro/frontend-toolkit", | ||
"directory": "packages/slash-to-regexp" | ||
}, | ||
"keywords": [ | ||
"data", | ||
"cache", | ||
"store", | ||
"config", | ||
"storage", | ||
"localStorage", | ||
"sessionStorage" | ||
] | ||
} |
# pet-shop | ||
A simple wrapper of Web Storage API. | ||
[npm-url]: https://www.npmjs.com/package/pet-shop | ||
[npm-badge]: https://img.shields.io/npm/v/pet-shop.svg?style=flat-square&logo=npm | ||
[github-url]: https://github.com/Airkro/regexp-toolset/tree/master/packages/pet-shop | ||
[node-badge]: https://img.shields.io/node/v/pet-shop.svg?style=flat-square&colorB=green&logo=node.js | ||
[license-badge]: https://img.shields.io/npm/l/pet-shop.svg?style=flat-square&colorB=blue&logo=github | ||
[![npm][npm-badge]][npm-url] | ||
[![license][license-badge]][github-url] | ||
![node][node-badge] | ||
## Installation | ||
```bash | ||
npm install pet-shop | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
2230
47
1
20
0