7.2.1 • Published 4 months ago

safe-typed-storage v7.2.1

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

safe-typed-storage 🗃

A safe, typed, and easy to use key-value storage library for the browser. Allows saving and retrieving serializable objects to localStorage, sessionStorage, with memory fallback.

Features

  • 🤩 Simple - Easy to use API
  • 🪢 Versatile - Use localStorage, sessionStorage, or memory
  • TTL - Set a time to live for your data
  • 🔒 Safe - Can be safely used in browser (no need to check if localStorage is available) or Node.js
  • 🚀 Small - Only 0.5kb gzipped

Installation

npm install safe-typed-storage

Usage

import sts from "safe-typed-storage";

// Create a new instance of the storage
const fooStorage = sts("FOO_KEY", { storage: "localStorage" });

// Set a value
fooStorage.set({ value: "bar" });

// Get a value
fooStorage.get(); // { value: 'bar' }

// Delete a value
fooStorage.remove();
7.2.1

4 months ago

7.2.0

4 months ago

7.0.0

1 year ago

7.1.0

1 year ago

6.2.0

2 years ago

6.1.0

2 years ago

6.0.0

2 years ago

5.0.0

2 years ago

4.0.0

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago