local-storage-query
v1.0.5
Published
lacal storage query
Downloads
12
Maintainers
Readme
Local Storage Query
Local Storage Query is a utility class designed to simplify interactions with the browser's localStorage API. This package provides methods to easily manage data stored in the browser's localStorage in asynchronous way, allowing for seamless integration with client side based JavaScript library and framework.
Installation
You can install the package via npm or yarn:
npm install local-storage-query
yarn add local-storage-query
Usage
import DB from "local-storage-query";
/*-------------------------Create an instance of DB-------------------*/
const db = new DB({
collectionName: "yourCollectionName",
latency: 1000,
});
/*-------------------------Methods-------------------*/
/*
success response : response res?.response.data.data or message
error response : error?.message
*/
const res = await db.create(data);
const res = await db.deleteById(id);
const res = await db.updateById(id, item);
const res = await db.findById(id);
const res = await db.find(null);
const res = await db.find({ name: "user" });
const res = await db.search({ keyName: searchTerm });
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests to contribute to this project.
License
This package is open-source and available under the MIT License.