{"id":13496427,"url":"https://github.com/gcanti/fp-ts-local-storage","last_synced_at":"2025-03-16T21:30:29.538Z","repository":{"id":57241192,"uuid":"142273540","full_name":"gcanti/fp-ts-local-storage","owner":"gcanti","description":"fp-ts bindings for LocalStorage","archived":false,"fork":false,"pushed_at":"2023-10-24T17:08:43.000Z","size":186,"stargazers_count":49,"open_issues_count":2,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-06T19:29:55.192Z","etag":null,"topics":["fp-ts","functional-programming","localstorage","typescript"],"latest_commit_sha":null,"homepage":"https://gcanti.github.io/fp-ts-local-storage/","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/gcanti.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2018-07-25T08:50:44.000Z","updated_at":"2023-10-24T17:08:45.000Z","dependencies_parsed_at":"2024-01-16T09:54:29.358Z","dependency_job_id":"0b058e20-3491-4c13-84c5-edb803c38454","html_url":"https://github.com/gcanti/fp-ts-local-storage","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Ffp-ts-local-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Ffp-ts-local-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Ffp-ts-local-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Ffp-ts-local-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gcanti","download_url":"https://codeload.github.com/gcanti/fp-ts-local-storage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830915,"owners_count":20354850,"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":["fp-ts","functional-programming","localstorage","typescript"],"created_at":"2024-07-31T19:01:47.716Z","updated_at":"2025-03-16T21:30:29.152Z","avatar_url":"https://github.com/gcanti.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Domain modeling in TypeScript by Benoit Ruiz"],"sub_categories":[],"readme":"[fp-ts](https://github.com/gcanti/fp-ts) bindings for LocalStorage\n\n# Documentation\n\n- [API Reference](https://gcanti.github.io/fp-ts-local-storage)\n\n**Example**\n\n```ts\nimport * as assert from 'assert'\nimport { setItem, getItem } from 'fp-ts-local-storage'\nimport { some } from 'fp-ts/Option'\nimport { pipe } from 'fp-ts/pipeable'\nimport { chain } from 'fp-ts/IO'\n\n// const program: IO\u003cOption\u003cstring\u003e\u003e\nconst program = pipe(\n  setItem('foo', JSON.stringify({ bar: 'baz' })),\n  chain(() =\u003e getItem('foo'))\n)\n\nassert.deepStrictEqual(program(), some('{\"bar\":\"baz\"}'))\n```\n\nNote that `localStorage` may throw, for example if disabled by the user or with a `QuotaExceededError`, so you may want to wrap the API call with a `tryCatch`\n\n```ts\nimport { setItem, getItem } from 'fp-ts-local-storage'\nimport { chain, tryCatch } from 'fp-ts/IOEither'\nimport { pipe } from 'fp-ts/pipeable'\nimport { toError } from 'fp-ts/Either'\n\n// const program: IOEither\u003cError, Option\u003cstring\u003e\u003e\nconst program = pipe(\n  tryCatch(setItem('foo', JSON.stringify({ bar: 'baz' })), toError),\n  chain(() =\u003e tryCatch(getItem('foo'), toError))\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcanti%2Ffp-ts-local-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgcanti%2Ffp-ts-local-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcanti%2Ffp-ts-local-storage/lists"}