{"id":13447539,"url":"https://github.com/jfet97/omniclone","last_synced_at":"2026-06-17T20:38:11.773Z","repository":{"id":57314330,"uuid":"164010850","full_name":"jfet97/omniclone","owner":"jfet97","description":"An isomorphic and configurable javascript utility for objects deep cloning that supports circular references. ","archived":false,"fork":false,"pushed_at":"2019-01-11T09:52:22.000Z","size":304,"stargazers_count":184,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-23T15:55:44.368Z","etag":null,"topics":["cloning","deep","javascript","objects"],"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/jfet97.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-01-03T18:51:29.000Z","updated_at":"2025-05-06T14:44:59.000Z","dependencies_parsed_at":"2022-09-20T23:21:19.228Z","dependency_job_id":null,"html_url":"https://github.com/jfet97/omniclone","commit_stats":null,"previous_names":["jfet97/deepclone"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/jfet97/omniclone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfet97%2Fomniclone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfet97%2Fomniclone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfet97%2Fomniclone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfet97%2Fomniclone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfet97","download_url":"https://codeload.github.com/jfet97/omniclone/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfet97%2Fomniclone/sbom","scorecard":{"id":517413,"data":{"date":"2025-08-11","repo":{"name":"github.com/jfet97/omniclone","commit":"4188d50536ab073f198c0599462b8a52f3000f39"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"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":"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":"Code-Review","score":0,"reason":"Found 0/21 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":"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":"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":"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":"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":"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":"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":"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 13 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":0,"reason":"86 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-vh7m-p724-62c2","Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-3gx7-xhv7-5mx3","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-vvj3-85vf-fgmw","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-h9rv-jmmf-4pgx","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"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-20T02:11:22.574Z","repository_id":57314330,"created_at":"2025-08-20T02:11:22.574Z","updated_at":"2025-08-20T02:11:22.574Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34465322,"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-17T02:00:05.408Z","response_time":127,"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":["cloning","deep","javascript","objects"],"created_at":"2024-07-31T05:01:20.437Z","updated_at":"2026-06-17T20:38:11.757Z","avatar_url":"https://github.com/jfet97.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![NPM version](https://img.shields.io/npm/v/omniclone.svg)](https://www.npmjs.com/package/omniclone) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/jfet97/omniclone/blob/master/LICENSE) ![](https://img.shields.io/npm/dt/omniclone.svg) ![](https://img.shields.io/badge/dependencies-no%20dependencies-%231e88e5%20.svg)\n# omniclone  \nAn isomorphic and configurable javascript function for object deep cloning.\n```js\nomniclone(source [, config, [, visitor]]);\n```\n\nExample:\n```js\nconst obj = { foo: { bar: 'baz' } };\nconst obj2 = omniclone(obj);\n\nobj2; // { foo: { bar: 'baz' } };\nobj === obj2; // false\nobj.foo === obj2.foo; // false\n```\n## installation\n```\n$ npm install --save omniclone\n```\n\n## usage\n```\nconst omniclone = require('omniclone');\nimport omniclone from 'omniclone';\n```\n\n## test\n[Test it](https://npm.runkit.com/omniclone) in no time with RunKit!\n\n## strengths\n1. automatically invoke object constructors before copying properties (customizable behavior)\n2. let you to share the `[[Prototype]]` object between source and the resulting object (customizable behavior)\n3. let you to clone objects with circular references (customizable behavior)\n4. let you to copy getters and setters, non enumerables properties and also symbols (customizable behavior)\n5. correct handling of String, Boolean, Number, Error, Promise, Map, Set, WeakMap, WeakSet, ArrayBuffer, TypedArray and DataView objects\n6. similar references are not duplicated\n7. correct cloning of Array objects\n8. correct cloning of RegExp and Date objects\n9. let you define custom cloning logic\n\n## config\n\n### invokeConstructors (default true)\nIf you need to invoke the objects constructors for each object prop set the `invokeConstructors` flag to `true`:\n```js\nconst res = omniclone(source, {\n  invokeConstructors: true\n});\n```\nThis option will correctly set up the new object, because __constructors are invoked to create it__. The resulting object and each of its object property therefore will have the `[[Prototype]]` and the `constructor` props correctly setted up, corresponding to the source object and its object properties for everyone.\n\n```js\nclass Test {\n  constructor() {\n    console.log('constructor invoked');\n  }\n};\n\nconst t = new Test(); // 'constructor invoked'\nt.foo = new Test(); // 'constructor invoked'\nt; // Test { t: Test {} }\n\nconst res = omniclone(t, {\n  invokeConstructors: true\n}); // 'constructor invoked' 'constructor invoked'\n\nres; // Test { t: Test {} }\nres instanceof Test; // true\nres.foo instanceof Test; // true\n```\n\nIt is actually a default enabled setting, but you can disable it (Array, Map and Set objects will be properly cloned anyway).\\\n__It is highly discouraged to disable this flag__, do it only if you know what you are doing.\n\nIf the `invokeConstructors` flag is set to `false`, a plain new object will be created for each object prop and for the resulting object as well. So the `constructor` prop will be set to the `Object` function, and the `[[Prototype]]` prop will be `Object.prototype`.\\\nUnless you use the `setPrototype` flag.\n\n\n### setPrototype (default false)\nIf the `invokeConstructors` flag is setted to `false` we could anyway share the `[[Prototype]]` object between the source object and the resulting object thanks to the `setPrototype` flag, __without calling the constructors__.\\\n(Array, Map and Set objects will be properly cloned anyway because for them the constructor will be always called).\\\nThis means that the `constructor` prop will be shared as well because it is related to the `[[Prototype]]` prop.\\\nThis flag affects all the object properties as weel, like the previous flag.\\\nIf the `invokeConstructors` flag is setted to `true`, the `setPrototype` flag will be is ignored.\n\n```js\nconst res = omniclone(source, {\n  invokeConstructors: false,\n  setPrototype: true\n});\n```\n\nThe resulting object therefore will have the `[[Prototype]]` and the `constructor` props correctly setted up, but the constructors are not invoked.\n\n```js\nclass Test {\n  constructor() {\n    console.log('constructor invoked');\n  }\n};\n\nconst t = new Test(); // 'constructor invoked'\nt.foo = new Test(); // 'constructor invoked'\nt; // Test { t: Test {} }\n\nconst res = omniclone(t, {\n  invokeConstructors: false,\n  setPrototype: true\n});\n\nres; // Test { t: Test {} }\nres instanceof Test; // true\nres.foo instanceof Test; // true\n```\n\n```js\nconst prot = { foo:'bar' };\n\nconst obj1 = Object.create(prot);\nObject.getPrototypeOf(obj1) === prot; // true\n\nconst res = omniclone(obj1, {\n  invokeConstructors: false,\n  setPrototype: true\n});\nObject.getPrototypeOf(res) === prot; // true\n```\n\n### copyNonEnumerables (default false)\nEnable it to deep copy also non enumerables properties.\\\nDisable it to ignore them.\n```js\nconst res = omniclone(source, {\n  copyNonEnumerables: true\n});\n```\n\n### copySymbols (default false)\nEnable it to deep copy also symbol properties.\\\nDisable it to ignore them.\\\nSymbols are shallow copied;\n```js\nconst res = omniclone(source, {\n  copySymbols: true\n});\n```\n\n### copyGettersSetters (default false)\nEnable it to copy also getters and setters.\\\nDisable it to ignore them.\n```js\nconst res = omniclone(source, {\n  copyGettersSetters: true\n});\n```\nOdds are that to properly copy gets\u0026setts you have also to enable the `copyNonEnumerables` flag.\n\n### allowCircularReferences (default true)\nEnable it to allow circular references.\\\nDisable it to throw an error if one is met.\nKnow that `omniclone` is more performing with this flag __enabled__, so disable it only if you really need.\n```js\nconst res = omniclone(source, {\n  allowCircularReferences: true\n});\n```\n\n### discardErrorObjects (default true)\nEnable it to discard Error objects props.\\\nKnow that `omnicopy` will return `null` if one is passed as source.\\\nDisable it to throw an error if one is met.\n```js\nconst res = omniclone(source, {\n  discardErrorObjects: true\n});\n```\n\n## default config\nThe default config is the following:\n```js\nomniclone(source, {\n    invokeConstructors : true,\n    setPrototype : false,\n    copyNonEnumerables : false,\n    copySymbols : false,\n    copyGettersSetters : false,\n    allowCircularReferences: true,\n    discardErrorObjects: true,\n});\n```\n\n## what about String, Boolean, Number, Error, Promise, Map, Set, WeakMap, WeakSet, ArrayBuffer, TypedArray and DataView objects?\n\nString, Boolean and Number objects passed to `omniclone` as sources will produce `null`.\\\nError objects passed to `omniclone` as sources will produce `null` if the `discardErrorObjects` is set to `true` (as default).\\\nError objects passed to `omniclone` as sources will produce a `TypeError` if the `discardErrorObjects` is set to `false` (not the predefined behaviour).\n\nString, Boolean and Number objects props will be unwrapped.\\\nError objects props will be discarded if the `discardErrorObjects` is set to `true` (as default).\\\nError objects props will produce a `TypeError` if the `discardErrorObjects` is set to `false` (not the predefined behaviour).\n\nPromise, WeakMap and WeakSet objects will be returned if passed to `omniclone` as sources.\\\nPromise, WeakMap and WeakSet objects props will be copied by reference.\n\nMap objects (keys/values) will be always deeply cloned, but any properties added to the map object itself will not be copied.\\\nSet objects will be always deeply cloned, but any properties added to the set object itself will not be copied.\\\nArrayBuffer and TypedArray objects will be always deeply cloned, but any properties added to the array objects themselves will not be copied.\nDataView objects are copied by reference.\n\n## what about the 6th strength?\n\nTo understand it, let's compare the function `omniclone` with the well-know `JSON.parse(JSON.stringify(source))`:\n```js\nconst obj = { foo: 'bar'};\nconst source = {\n  a: obj,\n  b: obj,\n};\n\nJSON.stringify(source); // '{\"a\":{\"foo\":\"bar\"},\"b\":{\"foo\":\"bar\"}}'\n```\nWhen you will use `JSON.parse()`, an `{\"foo\":\"bar\"}` object will be created for the `a` prop and a `{\"foo\":\"bar\"}` distinct object will be created for the `b` prop. But this is not the initial situation where `source.a == source.b; // true`.\n\n## how to define custom cloning logic?\nYou can define a callback function that will be called on each node which copy can be customized:\n```js\nfunction visitor(node, config) {\n  // do stuff\n}\n```\nThe function will receive the `node` and a copy of the `config` object. If the function returns something different than `undefined`, that returned value will become the cloned value. On the contrary if the function returns `undefined` the default cloning algorithm will be used.\n\nYou cannot overwrite the default algorithm logic for String, Boolean, Number, Error, Promise, Map, Set, WeakMap, WeakSet, Date and RegExp objects.\nYou can overwrite the default algorithm logic for Array, ArrayBuffer, TypedArray, DataView, plain js and custom objects.\n\nLet's see an example where we add custom logic to properly clone a Node.js Buffer object:\n```js\nconst buffer = Buffer.from([1, 2, 3, 4]);\n\nconst resBuffer = omniclone(buffer, {}, node =\u003e {\n  if (node instanceof Buffer) { // it affects only Buffer objects\n    return Buffer.from(node);\n  }\n  return undefined; // all the other nodes will be cloned as usual\n});\n```\nThanks to the `instanceof` check, only Buffer objects will be affected by the intervention of the visitor callback.\n\n\n## warnings and limitations\n1. promises and methods are always copied by reference\n2. `super` is statically bound to a class heirarchy, remember it\n3. `Error` objects cannot be properly copied because of js limitations\n4. currently there is no isomorphic way to detect if an object is a `Proxy` nor is possible to access the handler object. Because of transparent virtualization, `omniclone` will copy each properties, the `constructor` and the `[[Prototype]]` directly from the proxed object.\n\n## support\nLet me know that you like this project: star it! Thanks :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfet97%2Fomniclone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfet97%2Fomniclone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfet97%2Fomniclone/lists"}