Socket
Book a DemoInstallSign in
Socket

simple-local

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-local

Simple wrapper for localStorage. Makes dealing with localStorage less tedious.

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

simple-local

NPM version build status Test coverage

Simple wrapper for localStorage. Makes dealing with localStorage less tedious. Calls JSON.parse and JSON.stringify for you and uses debug under the hood to create a smooth debugging experience.

Installation

npm install simple-local

Overview

var local = require('simple-local');

local.set('myKey', {foo: 'bar', bin: 'baz'});

local.get('myKey')
// => {foo: 'bar', bin: 'baz'}

Debug

To enable debugging set in the browser console:

localStorage.debug = 'simple-local';

API

.set(value)

Set the store to contain a value at key.

store.set('key', 12348899);
store.set('config', ['foo', 'bar']);

.get(namespace)

Get a value from the store. Emits a get event which can be namespaced to allow for specific listeners.

store.get('config');
// => ['foo', 'bar']

License

MIT

Keywords

localStorage

FAQs

Package last updated on 02 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts