abarchibody

Ss storage

SS Storage is library that help to store data in the session storage, or retrieve data

Version Version: 0.0.1-1 Version Updated: 05/18/2022 By: abarchibody License: ISC

DownloadsLast30Days: 27

npm i ss-storage
yarn add ss-storage

SS-STORAGE

ss-storage is used:

  • Read data from the local storage
  • Write data to the local storage
  • Delete data from the local storage
  • Clear the local storage

Usage

Installation

npm i ss-storage --save

Data

const data = [1, 2, 3, 4];

Import storage from 'ss-storage'

import storage from "ss-storage";
Save to sessionstorage
storage.set("data", data);
Read to sessionstorage
const myData = storage.get("data");
console.log(myData);
// [1, 2, 3, 4]
Delete data to sessionstorage
storage.remove("data");
Clear sessionstorage
storage.clear();

Set method

  • Sets the value of the pair identified by key to value,
  • creating a new key/value pair if none existed for key previously.
storage.set(key: string, value: any): any
  • key string required: The key identifier of data to set
  • value any required: The value to store

If the value is set, it will return the value, else it will return null

Get method

Retrieves a value from the storage

storage.get(key: string): any

Returns the current value associated with the given key, or null if the given key does not exist.

Contributors


Dependencies


DevDependencies


Categories: StorageUtilities

Copyright © 2020 vuejscomponent.com