Storage(localStorage, sessionStorage) helper for KVS.
npm install @kvs/storage-syncStorage-like for KVS.
You can inject Storage object like localStorage, sessionStorage to this storage.
@kvs/storage is async version, but @kvs/storage-sync is sync version.
- Synchronize version [@kvs/storage]
- Support [Symbol.iterator] instead of [Symbol.asyncIterator]
- Injectable localStorage or sessionStorage
Install with npm:
npm install @kvs/storage-sync
``ts`
import assert from "assert";
import { kvsStorageSync } from "@kvs/storage";
(() => {
type StorageSchema = {
a1: string;
b2: number;
c3: boolean;
};
const storage = kvsStorageSync
name: "test",
version: 1,
storage: localStorage
});
storage.set("a1", "string");
storage.set("b2", 42);
storage.set("c3", false);
const a1 = storage.get("a1");
const b2 = storage.get("b2");
const c3 = storage.get("c3");
assert.strictEqual(a1, "string");
assert.strictEqual(b2, 42);
assert.strictEqual(c3, false);
})();
See Releases page.
Install devDependencies and Run npm test:
npm test
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
1. Fork it!
2. Create your feature branch: git checkout -b my-new-featuregit commit -am 'Add some feature'
3. Commit your changes: git push origin my-new-feature`
4. Push to the branch:
5. Submit a pull request :D
MIT © azu