{"_id":"@byburri/locsess-storage-helper","_rev":"2-65be89c4d470cb20ea43825b131ed4d9","name":"@byburri/locsess-storage-helper","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.1":{"name":"@byburri/locsess-storage-helper","version":"0.1.1","author":{"name":"byburri"},"license":"MIT","_id":"@byburri/locsess-storage-helper@0.1.1","maintainers":[{"name":"byburri","email":"byburri@gmail.com"}],"dist":{"shasum":"f5f60a1ebd876d2c6909aab8bf4d667b9f00c892","tarball":"https://registry.npmjs.org/@byburri/locsess-storage-helper/-/locsess-storage-helper-0.1.1.tgz","fileCount":36,"integrity":"sha512-Rdrxh169xMUd4cSHWpRHvm6gy6cnxTc7UuQjCaD5+2lzPWCvePuWU++IYXjjLhmjAlGI5UMonAxJrRxdn7aoTw==","signatures":[{"sig":"MEUCIC91PBcIKHzECyUnkElV5OZKfxqdbvTRLQHA4c+sKdgmAiEAqnSIT3l3A+aAg3rBslbzHuOjK8DjHp40SS13ugOY0pQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22692},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"49166aae87ad7a5ccac2a3184c2487eadd084819","scripts":{"lint":"eslint .","build":"tsc -p tsconfig.json","lint:fix":"eslint . --fix"},"_npmUser":{"name":"byburri","email":"byburri@gmail.com"},"_npmVersion":"10.8.2","description":"Browser storage helper","directories":{},"_nodeVersion":"20.19.2","_hasShrinkwrap":false,"devDependencies":{"jiti":"^2.6.1","eslint":"^9.39.2","globals":"^17.1.0","prettier":"^3.8.1","@eslint/js":"^9.39.2","typescript":"^5.9.3","@eslint/css":"^0.14.1","@eslint/json":"^0.14.0","@eslint/markdown":"^7.5.1","typescript-eslint":"^8.53.1","eslint-config-prettier":"^10.1.8"},"_npmOperationalInternal":{"tmp":"tmp/locsess-storage-helper_0.1.1_1769334990988_0.8105676335959504","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@byburri/locsess-storage-helper","description":"Browser storage helper","version":"0.1.2","main":"dist/index.js","types":"dist/index.d.ts","author":{"name":"byburri"},"license":"MIT","scripts":{"build":"tsc -p tsconfig.json","lint":"eslint .","lint:fix":"eslint . --fix"},"devDependencies":{"@eslint/css":"^0.14.1","@eslint/js":"^9.39.2","@eslint/json":"^0.14.0","@eslint/markdown":"^7.5.1","eslint":"^9.39.2","eslint-config-prettier":"^10.1.8","globals":"^17.1.0","jiti":"^2.6.1","prettier":"^3.8.1","typescript":"^5.9.3","typescript-eslint":"^8.53.1"},"_id":"@byburri/locsess-storage-helper@0.1.2","gitHead":"3a60c467376542af408d4e925a87653fe0c1f114","_nodeVersion":"20.19.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-UVZFFX8LBNWqO/HUu+xrTy27sHGO+2z6QalvKSHL0XfTLK/sX4M0ZMOwuagPKoOkzIY216BHxj9ILr49KmGqEA==","shasum":"83c22c0087c8ddb4037abef1601efc23f72f8fd9","tarball":"https://registry.npmjs.org/@byburri/locsess-storage-helper/-/locsess-storage-helper-0.1.2.tgz","fileCount":36,"unpackedSize":26023,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAesftkCNwL4m3lp0i5H3yyvi4tOHgTk7bkE7rPSKzxzAiEAjZkj0MsSw53yOVPhO0jwjK9RG0TY3rw6hhyGpmfKHKU="}]},"_npmUser":{"name":"byburri","email":"byburri@gmail.com"},"directories":{},"maintainers":[{"name":"byburri","email":"byburri@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/locsess-storage-helper_0.1.2_1769337170819_0.8302389757177417"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-25T09:56:30.903Z","modified":"2026-01-25T10:32:51.042Z","0.1.1":"2026-01-25T09:56:31.198Z","0.1.2":"2026-01-25T10:32:50.957Z"},"author":{"name":"byburri"},"license":"MIT","description":"Browser storage helper","maintainers":[{"name":"byburri","email":"byburri@gmail.com"}],"readme":"# @byburri/locsess-storage-helper\n\n[![npm version](https://img.shields.io/npm/v/@byburri/locsess-storage-helper)](https://www.npmjs.com/package/@byburri/locsess-storage-helper)\n[![npm downloads](https://img.shields.io/npm/dt/@byburri/locsess-storage-helper)](https://www.npmjs.com/package/@byburri/locsess-storage-helper)\n[![license](https://img.shields.io/npm/l/@byburri/locsess-storage-helper)](https://www.npmjs.com/package/@byburri/locsess-storage-helper)\n\nA lightweight TypeScript library for working with `localStorage` and `sessionStorage` with built-in key prefixing and TTL cache.\n\n---\n\n## Features\n\n- Safe `localStorage` / `sessionStorage` access with availability checks\n- Automatic key prefixing\n- TTL cache support (expires items automatically)\n- `clear()` only removes keys created by the library\n- Fully typed with TypeScript\n\n---\n\n## Installation\n\n```bash\n    # npm\n    npm install @byburri/locsess-storage-helper\n```\n\n```bash\n    # yarn\n    yarn add @byburri/locsess-storage-helper\n```\n\n## API\n`createLocalStorage(prefix?: string): LocalStorageApi` - creates a localStorage wrapper with an optional key prefix.\n\n### Example:\n    import { createLocalStorage } from \"@byburri/locsess-storage-helper\";\n    \n    const storage = createLocalStorage(\"myapp\");\n    \n    storage.set(\"token\", \"123\");\n    console.log(storage.get(\"token\")); // \"123\"\n    \n    storage.remove(\"token\");\n    \n    storage.clear(); // removes all keys starting with \"myapp-\"\n\n`createSessionStorage(prefix?: string): SessionStorageApi` - same as createLocalStorage, but uses sessionStorage instead.\n\n### Example:\n    import { createSessionStorage } from \"@byburri/locsess-storage-helper\";\n    \n    const storage = createSessionStorage(\"myapp\");\n    \n    storage.set(\"token\", \"123\");\n    console.log(storage.get(\"token\")); // \"123\"\n    \n    storage.remove(\"token\");\n    \n    storage.clear(); // removes all keys starting with \"myapp-\"\n\n## Methods\n### Local Storage\n\n`get(key)` - Get the value for a key\n\n`set(key, value)` -\tSet a value for a key\n\n`remove(key)` -\tRemove a key\n\n`clear()` -\tRemove all keys with the current prefix\n\n## Cache (TTL)\n\nSupports caching with automatic expiration.\n\n    const storage = createLocalStorage(\"myapp\");\n    \n    // Store user object for 10 minutes\n    storage.cacheSet(\"user\", { name: \"Denys\" }, 1000 * 60 * 10);\n    \n    const user = storage.cacheGet(\"user\"); // returns the cached value\n    \n    storage.cacheRemove(\"user\"); // remove a cached key\n    \n    storage.cacheFlushExpired(); // removes all expired cache entries\n\n## Key Prefixes\n\nBy default, the library uses the prefix: `locsess-`\n\n\nYou can provide a custom prefix:\n\n    const storage = createLocalStorage(\"myapp\");\n\n\nAll keys will be stored as:\n\n    myapp:key\n\n\nThis helps to avoid collisions with other localStorage or sessionStorage keys.\n\n## TypeScript Usage\n\nThe package is fully typed. You can use ReturnType to get API types:\n\n    import { createLocalStorage } from \"@byburri/locsess-storage-helper\";\n    \n    type LocalStorageApi = ReturnType<typeof createLocalStorage>;\n    type SessionStorageApi = ReturnType<typeof createSessionStorage>;\n    \n    const storage: LocalStorageApi = createLocalStorage(\"myapp\");\n\n### Generic support\n    const storage = createLocalStorage(\"myapp\");\n    \n    storage.set(\"count\", 10);\n    const count = storage.get<number>(\"count\");","readmeFilename":"README.md"}