Socket
Socket
Sign inDemoInstall

localstorage

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localstorage - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"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
```
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