{"id":19417972,"url":"https://github.com/americanexpress/vitruvius","last_synced_at":"2025-04-24T13:34:12.668Z","repository":{"id":22034512,"uuid":"93082348","full_name":"americanexpress/vitruvius","owner":"americanexpress","description":"✨Vitruvius extends redux's combineReducers to allow developers to include a buildInitialState method on their reducer","archived":false,"fork":false,"pushed_at":"2024-12-23T13:41:32.000Z","size":999,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-14T07:17:47.950Z","etag":null,"topics":["one-app","react","reducer","state-management"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/americanexpress.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-01T17:25:47.000Z","updated_at":"2024-12-23T13:41:36.000Z","dependencies_parsed_at":"2024-01-02T17:48:38.486Z","dependency_job_id":"74f6429f-c4ec-4650-a740-20838f278966","html_url":"https://github.com/americanexpress/vitruvius","commit_stats":{"total_commits":65,"total_committers":18,"mean_commits":3.611111111111111,"dds":0.7692307692307692,"last_synced_commit":"b4aa332515b03571de2cff2a1e429f5c78687023"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fvitruvius","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fvitruvius/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fvitruvius/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fvitruvius/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/americanexpress","download_url":"https://codeload.github.com/americanexpress/vitruvius/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250636516,"owners_count":21463096,"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":["one-app","react","reducer","state-management"],"created_at":"2024-11-10T13:12:16.294Z","updated_at":"2025-04-24T13:34:12.338Z","avatar_url":"https://github.com/americanexpress.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vitruvius\n\n[![npm version](https://badge.fury.io/js/%40americanexpress%2Fvitruvius.svg)](https://badge.fury.io/js/%40americanexpress%2Fvitruvius)\n![Health Check](https://github.com/americanexpress/vitruvius/workflows/Health%20Check/badge.svg)\n\nVitruvius extends redux's `combineReducers` to allow developers to include a\n`buildInitialState` method on their reducer. This allows for the passing of\nlocals to build the initial state that wouldn't normally be available to a\nreducer when setting its initial state. For instance, one could pass some data\nfrom the request object.\n\n\u003e Want to get paid for your contributions to `vitruvius`?\n\u003e Send your resume to oneamex.careers@aexp.com\n\n## Installation\n\n```\n$ npm install --save @americanexpress/vitruvius\n```\n\n## Implementation\n\nBelow is an example of a reducer implementing a `buildInitialState` method and\nan example of vitruvius being implemented.\n\n```js\nimport { Map } from 'immutable';\n\nexport const SOME_ACTION = 'SOME_ACTION';\n\nconst buildInitialState = ({ data } = {}) =\u003e new Map({ foo: data || 'bar' });\n\nexport default function reducer(state = buildInitialState(), action) {\n  switch (action.type) {\n    case SOME_ACTION:\n      return state.set('foo', action.data);\n    default:\n      return state;\n  }\n}\n\nreducer.buildInitialState = buildInitialState;\n```\n\n\u003e **TIP**: To extend `combineReducers` from `redux-immutable` instead of `redux`\nimport from `@americanexpress/vitruvius/immutable`.\n\n```js\nimport vitruvius from '@americanexpress/vitruvius';\n\nconst reducer = vitruvius({\n  stuff: stuffReducer,\n  things: thingsReducer,\n  ...otherReducers,\n});\n\nconst store = createStore(reducer, reducer.buildInitialState(locals), enhancer);\n```\n\n\n## Contributing\nWe welcome Your interest in the American Express Open Source Community on Github.\nAny Contributor to any Open Source Project managed by the American Express Open\nSource Community must accept and sign an Agreement indicating agreement to the\nterms below. Except for the rights granted in this Agreement to American Express\nand to recipients of software distributed by American Express, You reserve all\nright, title, and interest, if any, in and to Your Contributions. Please [fill\nout the Agreement](https://cla-assistant.io/americanexpress/).\n\n## License\nAny contributions made under this project will be governed by the [Apache License\n2.0](https://github.com/americanexpress/vitruvius/blob/master/LICENSE.txt).\n\n## Code of Conduct\nThis project adheres to the [American Express Community Guidelines](https://github.com/americanexpress/vitruvius/wiki/Code-of-Conduct).\nBy participating, you are expected to honor these guidelines.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famericanexpress%2Fvitruvius","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famericanexpress%2Fvitruvius","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famericanexpress%2Fvitruvius/lists"}