{"id":19090743,"url":"https://github.com/kodedninja/choo-shortcut","last_synced_at":"2026-05-24T20:30:16.347Z","repository":{"id":143857855,"uuid":"180865713","full_name":"kodedninja/choo-shortcut","owner":"kodedninja","description":"Shortcut access to parts of the state anywhere in your app","archived":false,"fork":false,"pushed_at":"2019-04-11T19:45:01.000Z","size":2,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-02T22:30:18.416Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/kodedninja.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":"2019-04-11T19:42:27.000Z","updated_at":"2019-08-19T12:33:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7cdb2ab-d23d-4c76-af0e-b6e8e9f931d3","html_url":"https://github.com/kodedninja/choo-shortcut","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/kodedninja%2Fchoo-shortcut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodedninja%2Fchoo-shortcut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodedninja%2Fchoo-shortcut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodedninja%2Fchoo-shortcut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kodedninja","download_url":"https://codeload.github.com/kodedninja/choo-shortcut/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240138132,"owners_count":19753870,"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-09T03:08:52.572Z","updated_at":"2026-05-24T20:30:16.302Z","avatar_url":"https://github.com/kodedninja.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# choo-shortcut\nShortcut access to parts of the `state` anywhere in your app.\n\nUseful to simulate \"contexts\", avoid passing down the `state` to hell. It's again a ridiculous little function.\n\n## Installation\n```\nnpm i choo-shortcut\n```\n\n## Example\n```javascript\n// flowers-context.js\nvar createShortcut = require('choo-shortcut')\n\nvar shortcut = createShortcut(function (state, emitter) {\n  return state.flowers\n})\n\nmodule.exports = shortcut.set\nmodule.exports.getFlowers = shortcut.get\n```\n\nIn your main file:\n\n```javascript\napp.use(require('./flowers-context'))\n```\n\nThen anywhere in your app\n\n```javascript\nvar { getFlowers } = require('../flowers-context')\n\ngetFlowers()\n// state.flowers that has been set somewhere\n```\n\n## API\n### `shortcut = createShortcut(reducer(state, emitter))`\nCreates a new shortcut (context store). `reducer` is a function which \"reduces\" the state to the part that should be stored. It gets the typical `state` and `emitter` of a Choo store.\n\n### `shortcut.set(state, emitter)`\nThe store that should be passed to `app.use`.\n\n### `shortcut.get()`\nReturns the current value that's stored.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodedninja%2Fchoo-shortcut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkodedninja%2Fchoo-shortcut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodedninja%2Fchoo-shortcut/lists"}