{"id":19083756,"url":"https://github.com/justgage/reason-cookie","last_synced_at":"2025-04-30T08:57:58.570Z","repository":{"id":57123429,"uuid":"130513441","full_name":"justgage/reason-cookie","owner":"justgage","description":"A simple way to use cookies in Reason (OCaml) on the frontend. 🍪","archived":false,"fork":false,"pushed_at":"2019-02-10T23:43:10.000Z","size":134,"stargazers_count":17,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-30T08:57:52.573Z","etag":null,"topics":["cookie","cross-browser","easy-to-use","frontend","json","reasonml","yolo"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/justgage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-21T21:30:37.000Z","updated_at":"2023-05-10T10:33:41.000Z","dependencies_parsed_at":"2022-08-26T20:22:55.659Z","dependency_job_id":null,"html_url":"https://github.com/justgage/reason-cookie","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justgage%2Freason-cookie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justgage%2Freason-cookie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justgage%2Freason-cookie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justgage%2Freason-cookie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justgage","download_url":"https://codeload.github.com/justgage/reason-cookie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251674576,"owners_count":21625644,"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","cross-browser","easy-to-use","frontend","json","reasonml","yolo"],"created_at":"2024-11-09T02:48:57.801Z","updated_at":"2025-04-30T08:57:58.532Z","avatar_url":"https://github.com/justgage.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Reason Cookie Logo](https://raw.githubusercontent.com/justgage/reason-cookie/master/logo.png)\n\n#  🍪 ReasonCookie\n\nA simple way to use cross-browser cookies that contain JSON.\n\nNote this wraps [js-cookie](https://github.com/js-cookie/js-cookie)\n\n# Is it ready for prime time?\n\nThese are just some simple bindings to the library it wraps. I've used it on some side projects but it should be _reasonably_ good. The underlying library is pretty battle tested and can even work in older browsers.\n\n# Install\n\n```\nnpm install --save @justgage/reason-cookie\n```\n\nThen in your `bsconfig.json`.\n\n```\n  \"bs-dependencies\": [\"@justgage/reason-cookie\"],\n```\n\n# API 😋\n\n### Working with string values\n\n```reason\nopen JustgageReasonCookie;\n\nCookie.getAsString(\"hello\") /* None */\nCookie.setString(\"hello\", \"test\");\nCookie.getAsString(\"hello\") /* Some(\"test\") */\n```\n\n### Working with JSON\n\n```reason\nopen JustgageReasonCookie;\n\nlet obj = Js.Dict.empty();\nJs.Dict.set(obj, \"a\", Js.Json.number(2.));\nlet obj = Js.Json.object_(obj);\n\nCookie.setJson(\"hello\", obj);\n\nlet maybeCookie = Cookie.getAsJson(\"hello\");\n```\n\n### Set path/expiry\n\n* **expires**: number of days till it's gone.\n* **path**: this scopes it to a page on your website (note: haven't used this personally)\n\n(see [js-cookie](https://github.com/js-cookie/js-cookie) for more uses)\n\n```reason\nopen JustgageReasonCookie;\n\nCookie.setJsonConfig(\n  \"hello\",\n  obj,\n  Cookie.makeConfig(~path=\"\", ~expires=2, ()),\n);\n```\n\n# Contribute?\n\nBest thing somone can do is just use it and find any problems it has.\n\nAbsolutely! Just make an issue. Please note that I usually ask people to make the changes themselves.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustgage%2Freason-cookie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustgage%2Freason-cookie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustgage%2Freason-cookie/lists"}