Expirable data storage wrapper around localStorage and sessionStorage for the browser. Version 1.0.0 with no release cadence reported. Supports automatically expiring items based on a TTL in seconds, and removes expired entries on getItem access. Lightweight, TypeScript-first package with no dependencies. Differentiates from similar libraries (e.g., localForage, idb-keyval) by providing a simple, symmetrical expirable wrapper for both persistent and session scopes.
npm install expirable-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import and use both expirableLocalStorage and expirableSessionStorage with a 15-minute TTL.
Ensure you call getItem to trigger cleanup; consider a periodic cleanup if many keys accumulate.
Always pass seconds, e.g., 900 for 15 minutes, not 900000.
Check that the code runs in a browser or use a polyfill.
import { expirableLocalStorage } from 'expirable-storage';Run 'npm install expirable-storage' and ensure 'node_modules' is in the include paths.
Only use this package in browser contexts or provide a localStorage polyfill.
No dependency data recorded yet.