New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

storage-factory

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storage-factory

Becasue using localStorage directly is a bad idea

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
increased by2.05%
Maintainers
1
Weekly downloads
 
Created
Source

storage-factory

This library is a tiny (1.1KB) wrapper for localStorage and sessionStorage because using storage directly is a bad idea. That's why.

Warning: object access (e.g. localStorage.foo) is not yet implemented 💥

Usage

Somewhere in your project

// storage.js
import { storageFactory } from "storage-factory";

export const local = storageFactory(localStorage);
export const session = storageFactory(sessionStorage);

When you need to use storage

import * as storage from "./storage";

function login(token) {
  storage.local.setItem("token", token);
  // do your other login things
}

Contribute

Do you want to contribute? Awesome! Please, create an issue first and tell me about it.

FAQs

Package last updated on 11 Jan 2019

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

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