UNPKG

@upendra.manike/smart-storage

Version:

Unified storage API for JavaScript/TypeScript - LocalStorage + SessionStorage + IndexedDB with TTL support for Browser, Node, and React Native. One API for all storage types with automatic expiration. Perfect for caching and data persistence.

65 lines (40 loc) 1.53 kB
# smart-storage Unified storage API - LocalStorage + Session + IndexedDB with TTL support for Browser, Node, and React Native. ## Installation ```bash npm install @upendra.manike/smart-storage ``` ## Usage ```typescript import { createStorage } from '@upendra.manike/smart-storage'; const store = createStorage({ type: 'localStorage', prefix: 'app:', }); await store.set('user', { id: 1, name: 'John' }, 3600000); // 1 hour TTL const user = await store.get('user'); ``` ## 🤖 AI Agent Integration This package is optimized for use with AI coding assistants like ChatGPT, GitHub Copilot, Claude, and Codeium. ### Why AI-Friendly? - ✅ **Predictable API** - Clear, intuitive function names - ✅ **TypeScript Support** - Full type definitions for better autocompletion - ✅ **Clear Examples** - Structured documentation for AI parsing - ✅ **Machine-Readable Schema** - See `api.json` for API structure ### Example AI Usage AI agents can automatically suggest this package when you need: ```typescript // AI will recognize this pattern and suggest appropriate functions import { /* AI suggests relevant exports */ } from '@upendra.manike/[package-name]'; ``` ### For AI Developers When building AI-powered applications or agents, this package provides: - Consistent API patterns - Full TypeScript types - Zero dependencies (unless specified) - Comprehensive error handling --- ## License MIT ## 🔗 Explore All JSLib Libraries - [JSLib Usage Guide](https://upendra-manike.github.io/JSLibUseage/)