radiant-moon-storage
v1.0.2
Published
A simple library for local storage management
Downloads
13
Maintainers
Readme
# Radiant Moon Storage
Radiant Moon Storage is a flexible and efficient storage library for JavaScript environments. It provides a simple interface for storing, retrieving, and managing data with the added feature of namespacing to organize your data efficiently.
Installation
You can install Radiant Moon Storage via npm:
npm install radiant-moon-storage
Usage
const RadiantMoonStorage = require('radiant-moon-storage');
// Create a new instance of RadiantMoonStorage with an optional namespace
const storage = new RadiantMoonStorage('mynamespace');
// Set an item in the storage
storage.setItem('myKey', 'myValue');
// Get an item from the storage
const value = storage.getItem('myKey');
// Remove an item from the storage
storage.removeItem('myKey');
// Clear all items in the storage (within the specified namespace)
storage.clear();
API
new RadiantMoonStorage(namespace)
Creates a new instance of RadiantMoonStorage with an optional namespace.
namespace
(optional): A string representing the namespace for the storage. Default is'default'
.
setItem(key, value)
Sets a key-value pair in the storage.
key
: The key for the item.value
: The value to be stored.
getItem(key)
Retrieves the value associated with the specified key from the storage.
key
: The key of the item to retrieve.
removeItem(key)
Removes the item associated with the specified key from the storage.
key
: The key of the item to remove.
clear()
Clears all items in the storage within the specified namespace.
License
This project is licensed under the MIT License - see the LICENSE file for details.