localstorage
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "localstorage", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
# SYNOPSIS | ||
A localStorage helper. Serialize and deserialize JSON, add namspaces, check for | ||
keys not found. | ||
Serialize and deserialize and namespace JSON in localstorage. | ||
@@ -8,3 +7,3 @@ # INSTALL | ||
```bash | ||
npm install voltraco/localstorage | ||
npm install localstorage | ||
``` | ||
@@ -16,16 +15,25 @@ | ||
const LocalStorage = require('localstorage') | ||
const user = new LocalStorage('user') // create the `user` namespace | ||
``` | ||
user.put('quxx', { foo: 100 }) | ||
```js | ||
const foo = new LocalStorage('foo') // create a `foo` namespace | ||
foo.put('quxx', { foo: 100 }) | ||
``` | ||
user.get('quxx') // [null, { foo: 100 }] | ||
user.get('foo') // [ErrorNotFOund] | ||
```js | ||
const [err, value] = foo.get('quxx') | ||
value.foo === 100 // true | ||
``` | ||
user.has('quxx') // [null, true] | ||
user.has('foo') // [ErrorNotFound] | ||
```js | ||
foo.get('quxx') // [null, { foo: 100 }] | ||
foo.get('foo') // [ErrorNotFOund] | ||
user.delete('quxx') // [null, true] | ||
user.delete('foo') // [ErrorNotFound] | ||
foo.has('quxx') // [null, true] | ||
foo.has('foo') // [ErrorNotFound] | ||
user.delete() // delete everything in the `user` namespace | ||
foo.delete('quxx') // [null, true] | ||
foo.delete('foo') // [ErrorNotFound] | ||
foo.delete() // delete everything in the `foo` namespace | ||
``` |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
3060
38
0