{"id":21948874,"url":"https://github.com/jamesnw/objectionable","last_synced_at":"2025-07-22T14:05:24.689Z","repository":{"id":65407688,"uuid":"554538619","full_name":"jamesnw/objectionable","owner":"jamesnw","description":"Track changes to Javascript values with a deep proxy. Figure out where you're breaking immutability expectations.","archived":false,"fork":false,"pushed_at":"2022-10-25T00:25:17.000Z","size":71,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-02T23:41:40.376Z","etag":null,"topics":["deep-proxy","javascript","javascript-library","npm-package","proxy"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesnw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-20T01:23:11.000Z","updated_at":"2024-12-17T20:26:59.000Z","dependencies_parsed_at":"2023-02-21T08:15:33.624Z","dependency_job_id":null,"html_url":"https://github.com/jamesnw/objectionable","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/jamesnw/objectionable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesnw%2Fobjectionable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesnw%2Fobjectionable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesnw%2Fobjectionable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesnw%2Fobjectionable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesnw","download_url":"https://codeload.github.com/jamesnw/objectionable/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesnw%2Fobjectionable/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266507366,"owners_count":23940055,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-proxy","javascript","javascript-library","npm-package","proxy"],"created_at":"2024-11-29T05:18:28.661Z","updated_at":"2025-07-22T14:05:24.665Z","avatar_url":"https://github.com/jamesnw.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Objectionable\n\nWhen something is mutating your data, and you don't know what it is, find it `objectionable`.\n\nThis will setup a deep proxy that will alert you whenever an object is mutated.\n\n```ts\nlet objected = objectionable([{ a: [0, { b: [{ c: 1 }] }] }]);\nobjected[0].a[1].b[0].c = 2;\n// Console.log \u003e\u003e \"Set: /0/a/1/b/0/c to 2\";\n```\n\nCheck tests to see all covered cases. Some highlights-\n\n- new key added\n- editing existing value\n- deep nesting, including mixed arrays and objects\n- new value added to array\n- length changed on array (implicitly and explicitly)\n\n## Get started\n\n1. Install:\n\n```bash\nnpm install objectionable\npnpm add objectionable\nyarn add objectionable\n```\n\n2. Import into your project:\n\n```ts\nimport objectionable from \"objectionable\";\n```\n\n3. Wrap any assignments to the value you want to track with `objectionable`.\n\n```ts\nlet observed = objectionable(newValue);\n```\n\nAny mutations to `observed` will be reported.\n\n4. Fix the issue, and uninstall `objectionable`. This strategy may have unintended consequences, so it's not recommended to use it long term.\n\n## Features:\n\n1. No dependencies\n1. Designed for temporary troubleshooting\n1. 100% test coverage\n1. Handles deeply nested array and objects\n1. Helpful for troubleshooting React, Vue and Svelte reactivity issues.\n\n## Options:\n\n`setValue` - Boolean, defaults to true\n\nIf true, object setting acts as normal. If false, the value won't change, and an error will be thrown on every set.\n\n`reporter` - callback, defaults to console.log of `Set: ${path} to ${value}`\n\nCallback receives the following arguments-\n\n- `object`- the entire observed object\n- `prop`- the specific key being set\n- `path`- a `/` separated path to the key\n- `value`- the value being set\n\nExample callback, which would throw an error when a specific key is changed-\n\n```ts\nconst callback: ObjectionableReporterCallback = function (\n  object,\n  property,\n  path,\n  value\n) {\n  if (path === \"deep/path/set\") {\n    throw new Error(`${path} set to ${value}`);\n  }\n};\n```\n\n# Other options\n\n- Roll your own recursive proxy.\n  - Certainly less overhead, but there are fair number of edge cases you may miss. For example, most StackOverflow solutions don't handle arrays.\n- https://github.com/samvv/js-proxy-deep or https://github.com/qiwi/deep-proxy\n  - Allows for more use cases of proxies, but requires more setup to solve this particular use.\n\n# Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesnw%2Fobjectionable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesnw%2Fobjectionable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesnw%2Fobjectionable/lists"}