{"id":15007672,"url":"https://github.com/charlesstover/deep-proxy-polyfill","last_synced_at":"2025-09-07T18:42:38.023Z","repository":{"id":33659100,"uuid":"156287697","full_name":"CharlesStover/deep-proxy-polyfill","owner":"CharlesStover","description":"Recursively proxies an object.","archived":false,"fork":false,"pushed_at":"2022-02-11T00:49:32.000Z","size":58,"stargazers_count":9,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-12T08:03:59.511Z","etag":null,"topics":["javascript","npm","npmjs","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/deep-proxy-polyfill","language":"TypeScript","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/CharlesStover.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":"2018-11-05T21:47:29.000Z","updated_at":"2024-04-26T01:50:37.000Z","dependencies_parsed_at":"2022-08-07T22:16:52.263Z","dependency_job_id":null,"html_url":"https://github.com/CharlesStover/deep-proxy-polyfill","commit_stats":null,"previous_names":["quisido/deep-proxy-polyfill","charlesstover/deep-proxy-polyfill"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesStover%2Fdeep-proxy-polyfill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesStover%2Fdeep-proxy-polyfill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesStover%2Fdeep-proxy-polyfill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesStover%2Fdeep-proxy-polyfill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CharlesStover","download_url":"https://codeload.github.com/CharlesStover/deep-proxy-polyfill/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219856362,"owners_count":16556084,"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":["javascript","npm","npmjs","typescript"],"created_at":"2024-09-24T19:13:19.428Z","updated_at":"2024-10-12T08:04:03.542Z","avatar_url":"https://github.com/CharlesStover.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deep Proxy Polyfill [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Deeply%20nest%20JavaScript%20Proxy's%20get%20and%20set%20property%20listeners,%20even%20in%20browsers%20that%20don't%20support%20Proxies!\u0026url=https://github.com/CharlesStover/deep-proxy-polyfill\u0026via=CharlesStover\u0026hashtags=javascript,typescript,webdev,webdevelopment)\n\nActs as a deep or recursive Proxy for getter and setter attributes on an object.\n\n[![version](https://img.shields.io/npm/v/deep-proxy-polyfill.svg)](https://www.npmjs.com/package/deep-proxy-polyfill)\n[![minified size](https://img.shields.io/bundlephobia/min/deep-proxy-polyfill.svg)](https://www.npmjs.com/package/deep-proxy-polyfill)\n[![minzipped size](https://img.shields.io/bundlephobia/minzip/deep-proxy-polyfill.svg)](https://www.npmjs.com/package/deep-proxy-polyfill)\n[![downloads](https://img.shields.io/npm/dt/deep-proxy-polyfill.svg)](https://www.npmjs.com/package/deep-proxy-polyfill)\n[![build](https://travis-ci.com/CharlesStover/deep-proxy-polyfill.svg)](https://travis-ci.com/CharlesStover/deep-proxy-polyfill/)\n\n## Install\n\n* `npm install deep-proxy-polyfill --save` or\n* `yarn add deep-proxy-polyfill`\n\n## Getter\n\n```JavaScript\nimport deepProxy from 'deep-proxy-polyfill';\n\nconst rootObject = {\n  a: {\n    b: {\n      c: 1\n    }\n  }\n};\n\nconst getHandler = (obj, key, root, keys) =\u003e {\n  assert(root === rootObject);\n\n  // [ 'a', 'b' ]\n  if (keys.length == 2) {\n    assert(obj === rootObject.a.b);\n    asset(key === 'c');\n    return obj[key] + 2;\n  }\n\n  return obj[key];\n};\n\nconst proxy = deepProxy(rootObject, { get: getHandler });\n\n// Getter returns an additional 2.\nassert(proxy.a.b.c === 3);\n```\n\n## Setter\n\n```JavaScript\nimport deepProxy from 'deep-proxy-polyfill';\n\nconst rootObject = {\n  a: {\n    b: {\n      c: 1\n    }\n  }\n};\n\n// Set values with an additional 2.\nconst setHandler = (obj, key, value, root, keys) =\u003e {\n  assert(root === rootObject);\n  obj[key] = value + 2;\n};\n\nconst proxy = deepProxy(rootObject, { set: setHandler });\nproxy.a.b.c = 3;\n\nassert(proxy.a.b.c === 5);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlesstover%2Fdeep-proxy-polyfill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharlesstover%2Fdeep-proxy-polyfill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlesstover%2Fdeep-proxy-polyfill/lists"}