{"id":16710473,"url":"https://github.com/gdotdesign/elm-storage","last_synced_at":"2025-04-10T05:35:09.199Z","repository":{"id":137704571,"uuid":"78445029","full_name":"gdotdesign/elm-storage","owner":"gdotdesign","description":"Unified interface for accessing and modifying LocalStorage, SessionStorage and Cookies","archived":false,"fork":false,"pushed_at":"2017-02-07T15:55:20.000Z","size":172,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T06:51:52.149Z","etag":null,"topics":["cookie","elm","localstorage","sessionstorage"],"latest_commit_sha":null,"homepage":"","language":"Elm","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/gdotdesign.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-09T16:07:18.000Z","updated_at":"2018-07-09T15:00:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"107479bf-52ee-4f40-b8fb-00c8b051f1ba","html_url":"https://github.com/gdotdesign/elm-storage","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdotdesign%2Felm-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdotdesign%2Felm-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdotdesign%2Felm-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gdotdesign%2Felm-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gdotdesign","download_url":"https://codeload.github.com/gdotdesign/elm-storage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248163853,"owners_count":21058035,"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":["cookie","elm","localstorage","sessionstorage"],"created_at":"2024-10-12T20:08:35.772Z","updated_at":"2025-04-10T05:35:09.190Z","avatar_url":"https://github.com/gdotdesign.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elm-storage\n[![Build Status](https://travis-ci.org/gdotdesign/elm-storage.svg?branch=master)](https://travis-ci.org/gdotdesign/elm-storage)\n![Elm Package Version](https://img.shields.io/badge/elm%20package-1.0.0-brightgreen.svg)\n\nThis module provides a unified interface for accessing and modifying\n**LocalStorage**, **SessionStorage** and **Cookies**.\n\n## Installation\nAdd `gdotdesign/elm-storage` to your dependencies:\n\n```json\n\"dependencies\": {\n  \"gdotdesign/elm-storage\": \"1.0.0 \u003c= v \u003c 2.0.0\"\n}\n```\n\nAnd install with [elm-github-install](https://github.com/gdotdesign/elm-github-install) using the `elm-install` command.\n\n## Usage\nThe following functions are available for `Storage.Local`, `Storage.Session`:\n\n```elm\n-- Asynchronous\nget : String -\u003e Task Error (Maybe String)\nset : String -\u003e String -\u003e Task Error ()\nremove : String -\u003e Task Error ()\nkeys : Task Error (List String)\nlength : Task Error Int\nclear : Task Error ()\n\n-- Synchronous\ngetSync : String -\u003e Result Error (Maybe String)\nsetSync : String -\u003e String -\u003e Result Error ()\nkeysSync : () -\u003e Result Error (List String)\nremoveSync : String -\u003e Result Error ()\nlength : () -\u003e Result Error Int\nclear : () -\u003e Result Error ()\n```\n\nand a slightly different version for `Storage.Cookie`:\n\n```elm\n-- Asynchronous\nset : String -\u003e String -\u003e SetOptions -\u003e Task Error ()\nremove : String -\u003e RemoveOptions -\u003e Task Error ()\nget : String -\u003e Task Error (Maybe String)\nclear : RemoveOptions -\u003e Task Error ()\nkeys : Task Error (List String)\nlength : Task Error Int\n\n-- Synchronous\nsetSync : String -\u003e String -\u003e SetOptions -\u003e Result Error ()\nremoveSync : String -\u003e RemoveOptions -\u003e Result Error ()\ngetSync : String -\u003e Result Error (Maybe String)\nkeysSync : () -\u003e Result Error (List String)\nclear : RemoveOptions -\u003e Result Error ()\nlength : () -\u003e Result Error Int\n\n-- Options\ntype alias SetOptions =\n  { domain : String\n  , expires : Float\n  , secure : Bool\n  , path : String\n  }\n\ntype alias RemoveOptions =\n  { domain : String\n  , path : String\n  }\n```\n\n## Testing\nThe module contains **steps and assertions** to use with [elm-spec](https://github.com/gdotdesign/elm-spec). Check out the [specs](spec) on how to use them, and here is a quick example:\n\n```elm\nimport Spec exposing (..)\n\nimport Storage.Spec.Local exposing (localStorage)\n\ntests : Node\ntests =\n  describe \"Local Storage\"\n    [ it \"should be testable\"\n      [ localStorage.clear\n      , localStorage.set \"user\" \"yoda\"\n      , localStorage.hasItem \"user\"\n      , localStorage.valueEquals \"user\" \"yoda\"\n      , localStorage.haveNumberOfItems 1\n      , localStorage.haveItems [\"user\"]\n      ]\n    ]\n\nmain =\n  run tests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgdotdesign%2Felm-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgdotdesign%2Felm-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgdotdesign%2Felm-storage/lists"}