{"id":13793525,"url":"https://github.com/okwolf/hyperapp-freeze","last_synced_at":"2025-05-12T20:31:04.904Z","repository":{"id":44621245,"uuid":"101530206","full_name":"okwolf/hyperapp-freeze","owner":"okwolf","description":"Deep-freeze your Hyperapp state to keep you honest about immutability","archived":false,"fork":false,"pushed_at":"2022-02-04T04:45:18.000Z","size":38,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-08T09:18:58.518Z","etag":null,"topics":["freeze","hyperapp","immutable"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/okwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-27T04:42:49.000Z","updated_at":"2022-02-09T18:59:02.000Z","dependencies_parsed_at":"2022-09-02T06:54:25.394Z","dependency_job_id":null,"html_url":"https://github.com/okwolf/hyperapp-freeze","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/okwolf%2Fhyperapp-freeze","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okwolf%2Fhyperapp-freeze/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okwolf%2Fhyperapp-freeze/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okwolf%2Fhyperapp-freeze/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/okwolf","download_url":"https://codeload.github.com/okwolf/hyperapp-freeze/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253816694,"owners_count":21968868,"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":["freeze","hyperapp","immutable"],"created_at":"2024-08-03T23:00:23.383Z","updated_at":"2025-05-12T20:31:04.577Z","avatar_url":"https://github.com/okwolf.png","language":"JavaScript","readme":"# Hyperapp Freeze\n\n[![Build Status](https://github.com/okwolf/hyperapp-freeze/actions/workflows/ci.yml/badge.svg)](https://github.com/okwolf/hyperapp-freeze/actions)\n[![Codecov](https://img.shields.io/codecov/c/github/okwolf/hyperapp-freeze/master.svg)](https://codecov.io/gh/okwolf/hyperapp-freeze)\n[![npm](https://img.shields.io/npm/v/hyperapp-freeze.svg?maxAge=2592000?style=plastic)](https://www.npmjs.com/package/hyperapp-freeze)\n\nA [Hyperapp](https://github.com/jorgebucaran/hyperapp) [dispatch initializer](https://github.com/jorgebucaran/hyperapp/blob/main/docs/architecture/dispatch.md#dispatch-initializer) that [deep freeze](https://github.com/substack/deep-freeze)s the state passed to each of your actions and view, giving you an error during development if you mutate state directly. If you or someone you love comes from an imperative programming background (where you might do things like `state++` instead of `return state + 1`) then this might be useful for you and your development team.\n\nPerhaps you work with backend developers who are perfectly competent engineers, but need some help adjusting to writing functional state updates and stateless components. Take Emily for example: she wants to show a list of items in the view ordered by a property of the user's choosing. Her array of items in the state is in a different order so she calls `sort` on the array from inside the view. Now there are weird bugs introduced because the array items in the state are in a different order. Emily's friend Sam sees the bug and adds Hyperapp Freeze to their dev build to complain loudly when evil direct state mutations are made. Sam catches the source of the bug, and updates the view to copy the array items before sorting them based on the user's preferences.\n\n## You might not need this\n\nIf you work on a team of seasoned functionalistas who are disciplined in immutability and don't need training wheels then Hyperapp Freeze is not meant for you. This is intended only for use in dev when you want to enforce no mutations as strictly as using a purely functional language like [Elm](http://elm-lang.org) would. The reasons you would want this vary from functional philosophical dogma to simple/predictable testing/debugging to avoiding real bugs in production caused by reckless mutation. This does come with a performance hit, so please ensure you are not using it in your production builds.\n\n## Installation\n\n### Node.js\n\nInstall with npm / Yarn.\n\n\u003cpre\u003e\nnpm i \u003ca href=\"https://www.npmjs.com/package/hyperapp-freeze\"\u003ehyperapp-freeze\u003c/a\u003e\n\u003c/pre\u003e\n\nThen with a module bundler like [rollup](https://github.com/rollup/rollup) or [webpack](https://github.com/webpack/webpack) use as you would anything else.\n\n```js\nimport freeze from \"hyperapp-freeze\";\n```\n\nOr using require.\n\n```js\nconst freeze = require(\"hyperapp-freeze\");\n```\n\n### Browser\n\nDownload the minified library from the [CDN](https://unpkg.com/hyperapp-freeze).\n\n```html\n\u003cscript src=\"https://unpkg.com/hyperapp-freeze\"\u003e\u003c/script\u003e\n```\n\nYou can find the library in `window.hyperappFreeze`.\n\n## Usage\n\n```js\napp({\n  init,\n  view,\n  node,\n  dispatch: freeze\n});\n```\n\nAnd your state is now frozen! ❄️\n\n## License\n\nHyperapp Freeze is MIT licensed. See [LICENSE](LICENSE.md).\n","funding_links":[],"categories":["Utilities V1"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokwolf%2Fhyperapp-freeze","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fokwolf%2Fhyperapp-freeze","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokwolf%2Fhyperapp-freeze/lists"}