1.0.4 • Published 1 month ago

session-storage-helper-lib v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

session-storage-helper-lib

A utility library for simplifying interactions with the web's session storage, including support for complex objects.

Installation

Install session-storage-helper-lib using npm:

npm install session-storage-helper-lib

Dependencies

  • lodash: A modern JavaScript utility library delivering modularity, performance & extras.
  • uuid: For the creation of RFC4122 UUIDs.

Usage

Here's how you can use session-storage-helper-lib:

const SessionStorageHelper = require('session-storage-helper-lib');

// Storing an item
SessionStorageHelper.setItem('myKey', { a: 1, b: 'Text' });

// Retrieving an item
const item = SessionStorageHelper.getItem('myKey');
console.log(item);

// Removing an item
SessionStorageHelper.removeItem('myKey');

// Clearing all items
SessionStorageHelper.clear();

// Generating a unique key
const uniqueKey = SessionStorageHelper.generateUniqueKey();
console.log(uniqueKey);

// Storing an item with a unique key
const key = SessionStorageHelper.storeWithUniqueKey({ c: 3, d: 'Another Text' });
console.log(key);
1.0.4

1 month ago

1.0.3

2 months ago

1.0.1-alpha

2 months ago