Managing localStorage
and sessionStorage
should be simple, lightweight, and powerful not bloated or painful.
That’s why I built Kando, a tiny (just ~2KB gzipped!) JavaScript library that gives you next-level control over browser storage with support for expiration times, deep nested objects, arrays, and TypeScript types.
No more writing repetitive boilerplate or worrying about browser quirks Kando handles it for you!
- Ultra lightweight: ~2KB gzipped
- Deep object and array support: access nested keys easily
- Session expiration: automatic expiry for sessionStorage items
- Fallback ready: works even if storage is unavailable
- TypeScript support: fully typed out of the box
- Zero dependencies: pure and clean JavaScript
- Open source and easy to extend
Installation
npm install kando-storage
<script src="path/to/kando.js"></script>
Quick Examples
Node.js
const kando = require('kando-storage');
// Set a nested value
kando('local.user.name', 'John Doe');
// Get a nested value
const userName = kando('local.user.name');
console.log(userName); // John Doe
// Remove a value
kando('local.user.name', null);
// Session storage with expiration (in seconds)
kando('session.auth.token', 'abcd1234', 3600); // Expires in 1 hour
Advanced Examples
// Store a namespaced object with arrays
kando('local.appConfig', {
theme: 'dark',
languages: ['en', 'es', 'fr'],
settings: { notifications: true, autoSave: false },
});
// Access nested array item
const languages = kando('local.appConfig.languages'); // ['en', 'es', 'fr']
// Update a setting within the nested object
kando('local.appConfig.settings.notifications', false);
// Add a new language to the languages array
kando('local.appConfig.languages[3]', 'de'); // ['en', 'es', 'fr', 'de']
Features You’ll Love
kando('local.cart.items[0].name', 'Laptop');
-
Safe Expiration Handling: If a
sessionStorage
item expires, Kando automatically cleans it up for you. -
Simple Deletion:
kando('local.settings.theme', null); // Deletes the theme
-
TypeScript Friendly: With provided
.d.ts
, you get full intellisense and stricter types while coding!
Why I Built Kando
Most storage utilities are either too heavy, too opinionated, or lack expiration support.
I wanted something minimal but smart enough for real-world applications, with deep nested paths and auto-cleanups built-in.
Thus, Kando was born: a “small but mighty” helper to make storage elegant again.
Get Involved
- GitHub Repository: Kando
- Star it if you like it contributions and feedback are super welcome!
Final Thoughts
If you’re tired of bloated libraries for simple storage needs give Kando a try.
It’s tiny, powerful, and built with developer happiness in mind.
Let’s make browser storage simple again!