{"id":16376444,"url":"https://github.com/bengl/copying","last_synced_at":"2026-04-07T00:30:19.038Z","repository":{"id":57207330,"uuid":"124207195","full_name":"bengl/copying","owner":"bengl","description":"A shallow copier that makes you make decisions","archived":false,"fork":false,"pushed_at":"2020-07-18T03:28:59.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T16:49:33.747Z","etag":null,"topics":["copy","javascript","property-descriptor","property-descriptors","shallow","shallowcopy"],"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/bengl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-07T08:52:02.000Z","updated_at":"2021-01-19T14:47:35.000Z","dependencies_parsed_at":"2022-09-11T05:02:29.529Z","dependency_job_id":null,"html_url":"https://github.com/bengl/copying","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bengl%2Fcopying","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bengl%2Fcopying/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bengl%2Fcopying/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bengl%2Fcopying/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bengl","download_url":"https://codeload.github.com/bengl/copying/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239970660,"owners_count":19727010,"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":["copy","javascript","property-descriptor","property-descriptors","shallow","shallowcopy"],"created_at":"2024-10-11T03:24:42.707Z","updated_at":"2026-04-07T00:30:18.959Z","avatar_url":"https://github.com/bengl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `copying`\n\n**`copying`** is a library for making shallow copies. It requires you to make\nparticular decisions about *how* you want properties to be copied from one\nobject to another, to avoid ambiguity about what's actually happening in the\ncopy.\n\nThis module exists to allow developers to make quick, *deliberate* decisions\nabout how properties ought to be copied between objects, without compromising\nany clarity about what's actually going on.\n\n## Usage\n\nThis module's `exports` is a function that takes in a mandatory options object\nwith the following properties, and returns a copier function.\n\n* **`enumerator`**: Must be one of the following string values:\n  * `\"enumerable\"`: The properties to copy will be iterated over using\n    `for .. in`.\n  * `\"ownKeys\"`: The properties to copy will be retrieved using\n    `Reflect.ownKeys`.\n  * `\"keys\"`: The properties to copy will be retrieved using `Object.keys`.\n* **`chain`**: Boolean. If true, the prototype chain will also be iterated over,\n  and prototype properties will be copied to destination objects (**not** to the\n  destination prototypes). If false, the prototype chain will not be used.\n* **`descriptor`**: Boolean. If true, properties will be copied by property\n  descriptor. If false, properties will be copied by their resolved values.\n\n\u003e **Note:** `for .. in` and `Object.keys` differ only in whether they include\n\u003e items in the prototype chain. Since we're deliberately choosing whether to\n\u003e iterate over the prototype chain, `enumerable` and `keys` are equivalent\n\u003e values for `enumerator`. Both are kept here, and implemented behind the scenes\n\u003e using the two different methods, in case there are performance differences\n\u003e between the two.\n\nThe returned copier function takes in objects similar to the way `Object.assign`\nworks. The first argument is the destination object to be copied to, and the\nremaining arguments are source objects to be copied from, in the order they\nappear.\n\n## Examples\n\nTODO (For now, take a look at the tests.)\n\n## License\n\nMIT License. See LICENSE.txt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbengl%2Fcopying","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbengl%2Fcopying","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbengl%2Fcopying/lists"}