{"id":18596194,"url":"https://github.com/pcrab/pls-storage","last_synced_at":"2025-11-02T06:30:21.489Z","repository":{"id":59791402,"uuid":"538548858","full_name":"Pcrab/pls-storage","owner":"Pcrab","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-18T09:11:27.000Z","size":353,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-27T14:02:21.514Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pcrab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-19T14:41:56.000Z","updated_at":"2022-09-19T14:42:41.000Z","dependencies_parsed_at":"2024-11-07T01:38:51.459Z","dependency_job_id":null,"html_url":"https://github.com/Pcrab/pls-storage","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"051c41935b2fd46a45dfa9f5143998fd5f243b61"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pcrab%2Fpls-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pcrab%2Fpls-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pcrab%2Fpls-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pcrab%2Fpls-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pcrab","download_url":"https://codeload.github.com/Pcrab/pls-storage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239379326,"owners_count":19628684,"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":[],"created_at":"2024-11-07T01:23:28.618Z","updated_at":"2025-11-02T06:30:21.453Z","avatar_url":"https://github.com/Pcrab.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pls-storage\n\nA simple typescript library to enhance browser local/session storage.\n\n## Usage\n\n`pls-storage` provides two storages: `lstorage` for `localStorage`, and `sstorage` for `sessionStorage`.\n\nValue can be any primitive type, or object that contains primitive types.\n\nFunctions can be stored due to the implementation of custom storage, but after reloading the page, all the functions will be lost.\n\n```typescript\nimport { lstorage } from \"pls-storage\";\n\n/** \n *  \"$PLS_STORAGE_testKey1\": '{\"value\":\"testStringValue\"}'\n */\nlstorage.setItem(\"testKey1\", \"testStringValue\");\nlstorage.getItem(\"testKey1\") // \"testStringValue\"\n\n/** \n *  \"$PLS_STORAGE_testKey2\": '{\"value\":{\"someValue1\":123,\"someValue2\":\"123\"}}'\n */\nlstorage.setItem(\"testKey2\", {\n    someValue1: 123,\n    someValue2: \"123\"\n});\nlstorage.getItem(\"testKey2\") // {someValue1: 123, someValue2: \"123\"}\n```\n\n`pls-storage` supports `readOnly` and `expiresAt` options.\n\n``` typescript\nimport { lstorage } from \"pls-storage\";\n\n/** \n *  \"$PLS_STORAGE_testKey3\": '{\"value\":\"testStringValue\",\"expiresAt\":\"2022-09-19T09:11:48.367Z\"}'\n */\nlstorage.setItem(\"testKey1\", \"testStringValue\", {\n    // new Date().toJSON();\n    expiresAt: new Date('2022-09-19T09:11:48.367Z')\n});\nlstorage.getItem(\"testKey1\") // undefined\n\n/** \n *  \"$PLS_STORAGE_testKey3\": '{\"value\":\"testStringValue\",\"readOnly\":true}'\n */\nlstorage.setItem(\"testKey2\", \"testStringValue\", {\n    readOnly: true\n});\nlstorage.setItem(\"testKey2\", \"changedValue\");\nlstorage.getItem(\"testKey2\") // \"testStringValue\"\n```\n\n## TODOs\n\n- [ ] Add custom storage support\n- [ ] Proxy on origin local/session storage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcrab%2Fpls-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpcrab%2Fpls-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcrab%2Fpls-storage/lists"}