Socket
Book a DemoInstallSign in
Socket

storage-wrap

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storage-wrap

Simple storage wrapper for the browser

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Storage wrap

Nothing fancy, just a simple wrapper for local/sessionStorage that removes the need to keep parsing and stringifying objects.

Installation

Bower

bower install storage-wrap --save

NPM

npm install storage-wrap --save

Usage

It uses exactly the same API as the native Storage objects except it will try to JSON.parse objects and arrays.

// Saves as - "{"foo":"bar"}"
storageWrap.setItem('test', {
	foo: 'bar'	
});

// Returns an object
storageWrap.getItem('test');

It uses localStorage by default, but it can easily be changed with setAdaptor

storageWrap.setAdaptor(sessionStorage);

Use it as a global or as an AMD module.

Tests

npm install
grunt test

FAQs

Package last updated on 13 Jan 2014

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