New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

locache

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

locache

Simple utility function to get and set data in your localStorage

latest
Source
npmnpm
Version
2.0.1
Version published
Maintainers
1
Created
Source

locache

Simple utility function to get and set data in your localStorage, and sessionStorage

Install

npm install locache

Usage for localStorage cache

import { cache } from 'locache';

Set (save) items in localStorage

var tom = {
  name: 'Tom',
  age: '26',
  height: 'tall',
  weight: '74kg'
}

cache('profile').set(tom);

Get items from localStorage

var profile = cache('profile').get();

profile will now equal the following

{
  name: 'Tom',
  age: '26',
  height: 'tall',
  weight: '74kg'
}

Remove items in localStorage

cache('profile').remove();

Usage for sessionStorage cache

import { sessionCache } from 'locache';

Set (save) items in sessionStorage

var tom = {
  name: 'Tom',
  age: '26',
  height: 'tall',
  weight: '74kg'
}

sessionCache('profile').set(tom);

Get items from sessionStorage

var profile = sessionCache('profile').get();

profile will now equal the following

{
  name: 'Tom',
  age: '26',
  height: 'tall',
  weight: '74kg'
}

Remove items in sessionStorage

sessionCache('profile').remove();

Keywords

localstorage

FAQs

Package last updated on 11 Oct 2018

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