{"id":15380932,"url":"https://github.com/alenaksu/secchiojs","last_synced_at":"2026-02-26T08:02:47.823Z","repository":{"id":36524486,"uuid":"220484807","full_name":"alenaksu/secchiojs","owner":"alenaksu","description":"Enhanced Web Storage API","archived":false,"fork":false,"pushed_at":"2023-01-09T03:19:41.000Z","size":461,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T09:34:42.256Z","etag":null,"topics":["localstorage","sessionstorage","storage","store","webstorage"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/secchiojs","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alenaksu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-08T14:36:02.000Z","updated_at":"2022-05-26T08:35:41.000Z","dependencies_parsed_at":"2023-01-17T02:18:09.652Z","dependency_job_id":null,"html_url":"https://github.com/alenaksu/secchiojs","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alenaksu%2Fsecchiojs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alenaksu%2Fsecchiojs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alenaksu%2Fsecchiojs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alenaksu%2Fsecchiojs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alenaksu","download_url":"https://codeload.github.com/alenaksu/secchiojs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247500479,"owners_count":20948881,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["localstorage","sessionstorage","storage","store","webstorage"],"created_at":"2024-10-01T14:25:03.943Z","updated_at":"2025-10-28T02:46:53.829Z","avatar_url":"https://github.com/alenaksu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# secchiojs\n[![GitHub release](https://img.shields.io/github/v/release/alenaksu/secchiojs.svg)](https://github.com/alenaksu/secchiojs/releases)\n[![npm](https://badgen.net/npm/v/secchiojs)](https://www.npmjs.com/package/secchiojs)\n[![downloads](https://badgen.net/npm/dt/secchiojs)](https://www.npmjs.com/package/secchiojs)\n[![Known Vulnerabilities](https://snyk.io/test/npm/secchiojs/badge.svg)](https://snyk.io/test/npm/secchiojs)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/secchiojs/master/LICENSE)\n\nEnhanced Web Storage API\n\n## Install\n\nyou can install the package through [npm](https://npmjs.com/) runnig:\n\n```bash\nnpm install secchiojs\n```\n\n## Usage\n\n### Typescript\n\n```ts\nimport { getBucket } from 'secchiojs';\n\ntype UserPrefs = {\n    name: string;\n    email: string;\n    mode: number;\n};\n\nconst [getPrefs, updatePrefs, deletePrefs] = getBucket\u003cUserPrefs\u003e(\n    'user-prefs',\n    {\n        version: 1,\n        defaultValue: {},\n        storage: localStorage,\n        expire: 3600,\n    }\n);\n\nconst userPrefs = getPrefs();\n\nupdatePrefs({\n    ...userPrefs,\n    mode: 2,\n});\n\ndeletePrefs();\n```\n\n### Javascript\n\n```js\nimport { getBucket } from 'secchiojs';\n\nconst [getPrefs, updatePrefs, deletePrefs] = getBucket('user-prefs', {\n    version: 1,\n    defaultValue: {},\n    storage: localStorage,\n    expire: 3600,\n});\n\nconst userPrefs = getPrefs();\n\nupdatePrefs({\n    ...userPrefs,\n    mode: 2,\n});\n\ndeletePrefs();\n```\n\n## API\n\n### getBucket\n\n#### Parameters\n\n-   `name` **string** The name of the bucket. It will be used as key when saving into the storage.\n-   `options` **BucketOptions** The bucket options.\n\n#### Returns\n\nThe function returns an array containing get, set and remove methods.\n\n```ts\nexport type Bucket\u003cT\u003e = [\n    // get\n    () =\u003e T,\n\n    // set\n    (value: T) =\u003e void,\n\n    // remove\n    () =\u003e void\n];\n```\n\n### BucketOptions\n\n-   `storage?` **Storage** An instance of a storage implementing the Web Storage interface (eg. localStorage, sessionStorage).\n-   `version?` **number** The version of the bucket.\n-   `expire?` **number** A number that indicates the expiration of the data. Default is 0, which means no expiration.\n-   `defaultValue?` **any** The default value returned if the data doesn't exist, or is expired or is from a different verision.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falenaksu%2Fsecchiojs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falenaksu%2Fsecchiojs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falenaksu%2Fsecchiojs/lists"}