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

@alzalabany/storage

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

@alzalabany/storage

Very small library add expiry and promise to localstorage

latest
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

app-storage, Promise based Local Storage for Web, Node, & React-Native

Very small library that makes working localstorage/sessionstorage on web/node/react-native easier by unifying api.

Features

  • Promise based
  • throw error if key is missing
  • throw error if key expired
  • Works with Browser SessionStorage, LocaStorage
  • Works with node Storage
  • Works with React-Native AsyncStorage
import { webStorage } from '@alzalabany/@alzalabany/storage';

const KEY = 'Hello';
const VAL = 'World';
const EXPIRY = 100;  // expiry is set in ms.

webStorage.setItem(KEY,VAL, EXPIRY)

setTimeout(()=>{
  // this will run after item has expired
  webStorage.getItem(KEY)
    .then(console.log) // will not resolve
    .catch(console.warn) // Expired error will be caught here
},110)

Keywords

localstorage

FAQs

Package last updated on 12 Aug 2021

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