A lightweight utility for easy set and get operations on Web Storage (localStorage and sessionStorage) with TypeScript type definitions. Current version 0.3.2, released as part of the react-atomic-organism monorepo. It provides a simple API to handle serialization/deserialization, supports default values, and works in browser environments. Compared to similar libraries like store2 or localForage, get-storage focuses on minimal footprint and ESM compatibility.
npm install get-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic set, get with default, remove operations, custom storage option, and TypeScript generics.
Update import to 'get-storage' directly
Store only JSON-serializable data.
Use { storage: sessionStorage } instead of { storageType: 'session' }Conditionally import or use a polyfill for server environments.
Check if window is defined: if (typeof window !== 'undefined') { /* use get-storage */ }Set 'type': 'module' in package.json or use dynamic import().
Ensure stored data has no circular references, or implement a custom serializer.
No dependency data recorded yet.