{"id":28684917,"url":"https://github.com/node-modules/copy-to","last_synced_at":"2025-06-14T03:07:51.994Z","repository":{"id":15409086,"uuid":"18141152","full_name":"node-modules/copy-to","owner":"node-modules","description":"copy an object's properties to another one","archived":false,"fork":false,"pushed_at":"2022-02-12T04:37:22.000Z","size":17,"stargazers_count":41,"open_issues_count":1,"forks_count":6,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-23T02:42:43.771Z","etag":null,"topics":[],"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/node-modules.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","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":"2014-03-26T14:34:50.000Z","updated_at":"2023-03-12T23:38:09.000Z","dependencies_parsed_at":"2022-08-30T14:11:24.737Z","dependency_job_id":null,"html_url":"https://github.com/node-modules/copy-to","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/node-modules/copy-to","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fcopy-to","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fcopy-to/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fcopy-to/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fcopy-to/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-modules","download_url":"https://codeload.github.com/node-modules/copy-to/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fcopy-to/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259752078,"owners_count":22905972,"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":[],"created_at":"2025-06-14T03:07:44.916Z","updated_at":"2025-06-14T03:07:51.982Z","avatar_url":"https://github.com/node-modules.png","language":"JavaScript","readme":"copy-to\n=======\n\n[![Build Status](https://travis-ci.org/node-modules/copy-to.svg?branch=master)](https://travis-ci.org/node-modules/copy-to)\n\ncopy an object's properties to another one, include propertiy, getter and setter.\n\n## Install\n\n```\nnpm install copy-to\n```\n\n## Usage\n\n```js\ncopy(src).to(des);\ncopy(src).toCover(des);\ncopy(src).override(des);\n\ncopy(src).pick('proName1', 'proName2').to(des);\ncopy(src).pick('proName1', 'proName2').toCover(des);\ncopy(src).pick('proName1', 'proName2').override(des);\n\ncopy(src).and(other).to(des);\ncopy(src).and(other).toCover(des);\ncopy(src).and(second).and(third).to(des);\n\ncopy(src).and(other).pick('proName1', 'proName2').to(des);\ncopy(src).and(other).pick('proName1', 'proName2').toCover(des);\ncopy(src).and(second).and(third).pick('proName1', 'proName2').to(des);\n```\n\nIt won't copy access(getter / setter) by default, if you want to copy them, please use:\n\n```js\ncopy(src).withAccess().and(other).to(des);\n```\n\n## Example\n\n```js\nvar copy = require('copy-to');\n\nvar src = {\n  _name: 'foo',\n  set name(val) {\n    this._name = val;\n  },\n  get name() {\n    return this._name;\n  },\n  show: function () {\n    console.log(this._name);\n  }\n};\n\nvar des = {\n  _name: 'bar'\n};\n\ncopy(src).to(des);\ncopy(src).toCover(des);\ncopy(src).pick('_name', 'name').to(des);\ncopy(src).pick('_name', 'name').toCover(des);\n```\n\n## License\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fcopy-to","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-modules%2Fcopy-to","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fcopy-to/lists"}