v0.4.3
A set of tools to manage localStorage, sessionStorage and more that run on browsers, node and deno. ๐พ
Repository
Current version released
4 years ago
storage-helpers โ
Description
A set of tools to manage localStorage, sessionStorage and more that run on browsers, node and deno.
Main features
tiny, less than 1kB, and tree-shakable.
optional storage key versioning and namespace.
optional custom serialization and hydration logic.
high typescript type and test coverage.
Simple example
const storageConfig = {
version: "v2",
namespace: "user-conf"
};
// persists on localStorage `[user-conf]i18n@v2` -> `{"locale":"es-ES","floatingPoint":"dot","unit":"metric"}`
setStorageItem("i18n", { locale: 'es-ES', floatingPoint: 'dot', unit: 'metric' }, storageConfig);
// returns `{"locale":"es-ES","floatingPoint":"dot","unit":"metric"}` hydrated
getStorageItem("i18n", storageConfig);
Installation
node
Add storage-helpers to package.json
npm i storage-helpers --save
deno
Import directly in your typescript files
import { setStorageItem } "https://deno.land/x/storage_helpers@v0.4.2/mod.ts";
UMD build
html files
<script src="https://unpkg.com/storage-helpers@0.4.2/dist/storage_helpers.umd.production.min.js"></script>
Documentation
- Storage helpers docs (github.com)
- Storage helpers docs (doc.deno.land)
- npm page
- deno.land page
- Changelog