Session Storage Utility
This project provides a set of utility functions for interacting with the browser's session storage. The Sessions
class offers methods to set, get, update, remove, and clear session storage items, as well as retrieve all session storage keys.
Installation
You can install the package via npm:
npm install @sophat/sessions
Or using yarn:
yarn add @sophat/sessions
Or using local via github
cd project_dir/packages && git clone https://github.com/pphatdev/sessions.git && npm link @sophat/sessions
Usage
Setting a Cookie
import { Sessions } from '@sophat/sessions';
Sessions.setItem('key', 'value');
Getting a Cookie
const value = Sessions.getItem('key');
Updating a Cookie
Sessions.updateItem('key', 'newValue');
Removing a Cookie
Sessions.removeItem('key');
Clearing All Cookies
Sessions.clear();
Getting All Cookie Keys
const keys = Sessions.getKeys();
License
This project is licensed under the MIT License.