{"id":29565613,"url":"https://github.com/rahazad/graph-reducer.js","last_synced_at":"2025-09-02T02:37:30.103Z","repository":{"id":57138605,"uuid":"322191961","full_name":"Rahazad/graph-reducer.js","owner":"Rahazad","description":"Something like lodash.merge() (a recursive version of Object.assign()) that specially designed for roudex","archived":false,"fork":false,"pushed_at":"2020-12-17T05:51:52.000Z","size":109,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-08T10:50:49.921Z","etag":null,"topics":["deep-assign","deep-object-assign","graph","javascript","js","merge","object","objects","payload","recursive-assign","recursive-object-assign","reucer","roudex","state","state-reducer"],"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/Rahazad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-17T05:35:31.000Z","updated_at":"2020-12-17T05:51:12.000Z","dependencies_parsed_at":"2022-09-03T15:51:55.520Z","dependency_job_id":null,"html_url":"https://github.com/Rahazad/graph-reducer.js","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Rahazad/graph-reducer.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahazad%2Fgraph-reducer.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahazad%2Fgraph-reducer.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahazad%2Fgraph-reducer.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahazad%2Fgraph-reducer.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rahazad","download_url":"https://codeload.github.com/Rahazad/graph-reducer.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rahazad%2Fgraph-reducer.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265837734,"owners_count":23836558,"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":["deep-assign","deep-object-assign","graph","javascript","js","merge","object","objects","payload","recursive-assign","recursive-object-assign","reucer","roudex","state","state-reducer"],"created_at":"2025-07-18T21:34:54.100Z","updated_at":"2025-07-18T21:34:55.191Z","avatar_url":"https://github.com/Rahazad.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Graph-Reducer\n\n\u003e **Something like [lodash.merge()](https://lodash.com/docs/4.17.15#merge) *(a recursive version of [`Object.assign()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign))* that specially designed for [roudex](https://github.com/Rahazad/roudex).**\n\u003e\n\u003e It additionally supports functions (in `payload(s)` argument(s)) to make it possible to transform properties based on their previous states/values.\n\u003e\n\u003e It also *deeply* compares the source state (source object) with the primary result (`newState`), during its original process and returns an additional value (`noTransform`) that shows the result of this comparison.\n\n\u003cp dir=\"auto\"\u003e\n\t\u003ca href=\"https://npmjs.com/package/@rahazad/graph-reducer\"\u003e\n\t\t\u003cimg alt=\"npm (scoped)\" src=\"https://img.shields.io/npm/v/@rahazad/graph-reducer.svg\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://packagephobia.now.sh/result?p=@rahazad/graph-reducer\"\u003e\n\t\t\u003cimg src=\"https://packagephobia.now.sh/badge?p=@rahazad/graph-reducer\" alt=\"install size\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://npmjs.com/package/@rahazad/graph-reducer\"\u003e\n\t\t\u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/dt/@rahazad/graph-reducer.svg\"\u003e\n\t\u003c/a\u003e\n\t\u003cbr\u003e\n\t\u003ca href=\"https://david-dm.org/Rahazad/graph-reducer.js\"\u003e\n\t\t\u003cimg src=\"https://david-dm.org/Rahazad/graph-reducer.js.svg\" alt=\"Dependencies Status\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://david-dm.org/Rahazad/graph-reducer.js?type=dev\"\u003e\n\t\t\u003cimg src=\"https://david-dm.org/Rahazad/graph-reducer.js/dev-status.svg\" alt=\"devDependencies Status\"\u003e\n\t\u003c/a\u003e\n\t\u003cbr\u003e\n\t\u003ca href=\"https://github.com/Rahazad/graph-reducer.js/blob/master/LICENSE\"\u003e\n\t\t\u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/license/Rahazad/graph-reducer.js.svg\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://github.com/Rahazad/graph-reducer.js/fork\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/github/forks/Rahazad/graph-reducer.js.svg?style=social\" alt=\"GitHub forks\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://github.com/Rahazad/graph-reducer.js\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/github/stars/Rahazad/graph-reducer.js.svg?style=social\" alt=\"GitHub stars\"\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n```bash\nnpm i @rahazad/graph-reducer\n```\n\nor using `yarn`:\n\n```bash\nyarn add @rahazad/graph-reducer\n```\n\n## Usage\n\n```javascript\nimport graphReducer from '@rahazad/graph-reducer'\n\nconst srcState = {\n    a: 'a',\n    n: 10,\n    v: {c: 'c'}\n}\n\nconst payloads = [\n    {\n        a: 'A',\n        v: {c: 'C'}\n    },\n    {\n        n: n =\u003e n * 2\n    },\n]\n\nconst {newState} = graphReducer(srcState, ...payloads)\n\nassert.deepStrictEqual(newState, {  // import assert from 'assert' // https://nodejs.org/api/assert.html\n    a: 'A',\n    n: 20,\n    v: {c: 'C'}\n})\n```\n\n## License\n\nMIT © [Mir-Ismaili](https://github.com/mirismaili)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahazad%2Fgraph-reducer.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahazad%2Fgraph-reducer.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahazad%2Fgraph-reducer.js/lists"}