{"id":19041937,"url":"https://github.com/writetome51/get-object-copy","last_synced_at":"2026-06-19T04:31:32.476Z","repository":{"id":122062417,"uuid":"221579982","full_name":"writetome51/get-object-copy","owner":"writetome51","description":"Returns new identical copy of object, including same prototype chain","archived":false,"fork":false,"pushed_at":"2021-02-28T02:06:37.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-09T04:43:53.537Z","etag":null,"topics":["clone","copy","deep-clone","dupe","instance","literal","object"],"latest_commit_sha":null,"homepage":null,"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/writetome51.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-14T00:49:33.000Z","updated_at":"2021-02-28T02:06:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"6fc5d9d0-7183-40e5-ae96-bdc409b40a66","html_url":"https://github.com/writetome51/get-object-copy","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"56e35dacd52fb54be7fd04755f6bb7653b01cc2c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/writetome51/get-object-copy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fget-object-copy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fget-object-copy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fget-object-copy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fget-object-copy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/writetome51","download_url":"https://codeload.github.com/writetome51/get-object-copy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fget-object-copy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34517748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["clone","copy","deep-clone","dupe","instance","literal","object"],"created_at":"2024-11-08T22:33:26.420Z","updated_at":"2026-06-19T04:31:32.457Z","avatar_url":"https://github.com/writetome51.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# getObjectCopy\\\u003cT\\\u003e(object: T): T\n\nReturns independent copy of `object`, with same prototype chain.\n\n## Examples\n```\n// These are tests you can run:\n\nexport class TestClass {\n    prop0 = {propA: {propB: {propC: {propD: 'value'}}}};\n    prop1 = 1;\n    prop2 = 2;\n\n    doThis() {\n        return this.prop1 + this.prop2;\n    }\n}\n\nexport class TestSubclass extends TestClass {\n    prop3 = this.doThis(); // 3\n}\n\nexport class TestSubSubclass extends TestSubclass {\n}\n\nlet original = new TestSubSubclass();\nlet copy = getObjectCopy(original);\n\n// Make sure copy is instanceof the most distant parent:\nif (copy instanceof TestClass) console.log('test 1 passed');\nelse console.log('test 1 FAILED');\n\n// Make sure copy is instanceof its immediate class:\nif (copy instanceof TestSubSubclass) console.log('test 2 passed');\nelse console.log('test 2 FAILED');\n\n// Make sure the copy is not just a reference to the original:\nif (copy !== original) console.log('test 3 passed');\nelse console.log('test 3 FAILED');\n\n// Make sure it contains the inherited method:\nif (copy.doThis \u0026\u0026 (copy.doThis() === copy.prop3)) console.log('test 4 passed');\nelse console.log('test 4 FAILED');\n\n// Make sure deeply nested properties are included in the copy:\nif (copy.prop0.propA.propB.propC.propD === 'value') console.log('test 5 passed');\nelse console.log('test 5 FAILED');\n```\n\n## Installation\n\nYou must have npm installed first.  Then, in the command line:\n\n```bash\nnpm i @writetome51/get-object-copy\n```\n\n## Loading\n```js\nimport {getObjectCopy} from '@writetome51/get-object-copy';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Fget-object-copy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwritetome51%2Fget-object-copy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Fget-object-copy/lists"}