{"id":17340956,"url":"https://github.com/ardentia/deep-copy","last_synced_at":"2026-01-20T04:02:17.076Z","repository":{"id":35046984,"uuid":"200361402","full_name":"ardentia/deep-copy","owner":"ardentia","description":"A package that returns a deep copy of a given object or array","archived":false,"fork":false,"pushed_at":"2022-03-24T10:45:12.000Z","size":29,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-22T20:58:34.742Z","etag":null,"topics":["copy","deep","deepcopy","es6","javascript","javascript-library","js","library","microlibrary","tool","typescript","util"],"latest_commit_sha":null,"homepage":"","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/ardentia.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":"2019-08-03T10:17:22.000Z","updated_at":"2022-01-27T10:46:41.000Z","dependencies_parsed_at":"2022-08-08T04:01:26.517Z","dependency_job_id":null,"html_url":"https://github.com/ardentia/deep-copy","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ardentia/deep-copy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardentia%2Fdeep-copy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardentia%2Fdeep-copy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardentia%2Fdeep-copy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardentia%2Fdeep-copy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ardentia","download_url":"https://codeload.github.com/ardentia/deep-copy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ardentia%2Fdeep-copy/sbom","scorecard":{"id":205869,"data":{"date":"2025-08-11","repo":{"name":"github.com/ardentia/deep-copy","commit":"208debeba57a0f1a57fce230f224fcdf7d937b9f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.4,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T23:44:18.311Z","repository_id":35046984,"created_at":"2025-08-16T23:44:18.312Z","updated_at":"2025-08-16T23:44:18.312Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28595321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["copy","deep","deepcopy","es6","javascript","javascript-library","js","library","microlibrary","tool","typescript","util"],"created_at":"2024-10-15T15:47:09.482Z","updated_at":"2026-01-20T04:02:17.043Z","avatar_url":"https://github.com/ardentia.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deep-copy\nThis microlibrary provides a deep copy of a given object or array.\n\n## Usage\nInstall the library:\n```bash\nnpm install @ardentia/deep-copy\n```\n\nThen, in the file where you want to use it:\n```typescript\n//ES6 / TypeScript\n\nimport getItemCopy from '@ardentia/deep-copy';\n\n//...\nconst copy = getItemCopy(\u003cvalue\u003e);\n```\n\n```javascript\n//node.js\n\nconst getItemCopy = require('@ardentia/deep-copy/node').default;\n\n//...\nconst copy = getItemCopy(\u003cvalue\u003e);\n```\n\nThe library is built to be ES6-, TypeScript and node.js-compatible.\n\n### Examples:\n\nThe values of the given object are recursively traversed and are also deep copied in case they are not primitive types. If the value is a primitive type, a copy by value is returned.\n\n```javascript\n//...\nconst myCustomObject = { \n  numberVal: 1,\n  stringVal: 'string',\n  arrayVal: [{ foo: 'bar' }, 1, 2, 3],\n  objectVal: { foo: 'bar', innerArray: [1, 2, 3] }\n};\n\nconst objectCopy = getItemCopy(myCustomObject);\n\nconsole.log(Object.is(objectCopy, myCustomObject)); \n//false -\u003e deep copy of object\n\nconsole.log(Object.is(objectCopy.numberVal, myCustomObject.numberVal)); \n//true -\u003e primitive type copied by value\n\nconsole.log(Object.is(objectCopy.stringVal, myCustomObject.stringVal)); \n//true -\u003e primitive type copied by value\n\nconsole.log(Object.is(objectCopy.arrayVal, myCustomObject.arrayVal)); \n//false -\u003e deep copy of array\n\nconsole.log(Object.is(objectCopy.arrayVal[0], myCustomObject.arrayVal[0])); \n//false -\u003e deep copy of object\n\nconsole.log(Object.is(objectCopy.objectVal, myCustomObject.objectVal)); \n//false -\u003e deep copy of object\n\nconsole.log(Object.is(objectCopy.objectVal.innerArray, myCustomObject.objectVal.innerArray)); \n//false -\u003e deep copy of array\n```\n\nSame deep copy logic applies to array members:\n```javascript\n//...\nconst myCustomArray = [\n  1,\n  'string',\n  { foo: 'bar', innerArray: [1, 2, 3] },\n  [{ foo: 'bar'}, 1, 2, 3]\n];\n\nconst arrayCopy = getItemCopy(myCustomArray);\n\nconsole.log(Object.is(arrayCopy, myCustomArray)); \n//false -\u003e deep copy of array\n\nconsole.log(Object.is(arrayCopy[0], myCustomArray[0]));\n//true -\u003e primitive type copied by value\n\nconsole.log(Object.is(arrayCopy[1], myCustomArray[1]));\n//true -\u003e primitive type copied by value\n\nconsole.log(Object.is(arrayCopy[2], myCustomArray[2]));\n//false -\u003e deep copy of object\n\nconsole.log(Object.is(arrayCopy[2].innerArray, myCustomArray[2].innerArray));\n//false -\u003e deep copy of array\n\nconsole.log(Object.is(arrayCopy[3], myCustomArray[3])); \n//false -\u003e deep copy of array\n\nconsole.log(Object.is(arrayCopy[3][0], myCustomArray[3][0])); \n//false -\u003e deep copy of object\n```\n\n**Note:** If the object you are attempting to copy contains children that recursively reference their parent object, the call to `getItemCopy(...)` will cause a range error exception: `Range Error: Maximum call stack size exceeded`. If such an object structure is possible in your case, you need to place the call to `getItemCopy(...)` in a try-catch construction:\n\n```typescript\nimport getItemCopy from '@ardentia/deep-copy';\n\nconst rootObj = {\n  childA: null,\n  childB: null\n};\n\nconst childA = {\n  a1: 'a1',\n  a2: 'a2',\n  root: rootObj\n};\n\nrootObj.childA = childA;\n\nconst childB = {\n  b1: 'b1',\n  b2: 'b2',\n  root: rootObj\n};\n\ntry {\n  const result = getItemCopy(rootObj);\n} catch(ex) {\n  // handle the range error exception\n}\n```\n## Local Development\n1. Fork the project and clone it locally\n2. `npm install` to install the library dependencies\n3. `npm install -g typescript` to install TypeScript globally\n4. `npm test` to run tests\n5. `npm run build` to build for production\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fardentia%2Fdeep-copy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fardentia%2Fdeep-copy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fardentia%2Fdeep-copy/lists"}