{"author":{"name":"tony_quetano@planttheidea.com"},"contributors":[{"name":"Dariusz Rzepka","email":"rzepkadarek@gmail.com"}],"browser":"dist/umd/index.js","bugs":{"url":"https://github.com/planttheidea/fast-copy/issues"},"description":"A blazing fast deep object copier","devDependencies":{"@rollup/plugin-node-resolve":"^14.1.0","@rollup/plugin-typescript":"^8.5.0","@types/eslint":"^8.4.6","@types/jest":"^29.0.3","@types/lodash":"^4.14.185","@types/node":"^18.7.18","@types/ramda":"^0.28.15","@types/react":"^18.0.20","@typescript-eslint/eslint-plugin":"^5.38.0","@typescript-eslint/parser":"^5.38.0","benchee":"^1.0.3","cli-table3":"^0.6.3","clone":"^2.1.2","deepclone":"^1.0.2","eslint":"^8.23.1","eslint-webpack-plugin":"^3.2.0","fast-clone":"^1.5.3","html-webpack-plugin":"^5.5.0","in-publish":"^2.0.1","jest":"^29.0.3","lodash":"^4.17.11","nyc":"^15.1.0","ramda":"^0.28.0","react":"^18.2.0","react-dom":"^18.2.0","release-it":"15.4.1","rollup":"^2.79.1","rollup-plugin-terser":"^7.0.2","ts-jest":"^29.0.1","ts-loader":"^9.4.1","typescript":"^4.8.3","webpack":"^5.74.0","webpack-cli":"^4.10.0","webpack-dev-server":"^4.11.1"},"exports":{".":{"import":{"types":"./dist/esm/types/index.d.ts","default":"./dist/esm/index.mjs"},"require":{"types":"./dist/cjs/types/index.d.ts","default":"./dist/cjs/index.cjs"},"default":{"types":"./dist/umd/types/index.d.ts","default":"./dist/umd/index.js"}}},"homepage":"https://github.com/planttheidea/fast-copy#readme","keywords":["clone","deep","copy","fast"],"license":"MIT","main":"dist/cjs/index.cjs","module":"dist/esm/index.mjs","name":"fast-copy","repository":{"type":"git","url":"git+https://github.com/planttheidea/fast-copy.git"},"scripts":{"benchmark":"npm run build:files && node benchmark/index.cjs","build":"npm run build:files && npm run build:types","build:files":"NODE_ENV=production rollup -c","build:types":"tsc -p ./tsconfig.cjs.json && tsc -p ./tsconfig.esm.json && tsc -p ./tsconfig.umd.json && tsc -p ./tsconfig.minified.json","clean":"rimraf dist","dev":"NODE_ENV=development webpack-dev-server --config=webpack/webpack.config.js","dist":"npm run clean && npm run build","lint":"eslint 'src/*.ts'","lint:fix":"npm run lint -- --fix","prepublishOnly":"npm run lint && npm run typecheck && npm run test && npm run dist","release":"release-it","release:beta":"release-it --config=.release-it.beta.json","release:dry":"release-it --dry-run","start":"npm run dev","test":"NODE_PATH=. jest","test:coverage":"npm run test -- --coverage","test:watch":"npm run test -- --watch","typecheck":"tsc src/*.ts --noEmit"},"type":"module","types":"index.d.ts","version":"3.0.0-beta.2","readme":"# fast-copy\n\n<img src=\"https://img.shields.io/badge/build-passing-brightgreen.svg\"/>\n<img src=\"https://img.shields.io/badge/coverage-100%25-brightgreen.svg\"/>\n<img src=\"https://img.shields.io/badge/license-MIT-blue.svg\"/>\n\nA [blazing fast](#benchmarks) deep object copier\n\n## Table of contents\n\n- [fast-copy](#fast-copy)\n  - [Table of contents](#table-of-contents)\n  - [Usage](#usage)\n  - [Options](#options)\n      - [isStrict](#isstrict)\n      - [realm](#realm)\n  - [Types supported](#types-supported)\n  - [Benchmarks](#benchmarks)\n      - [Simple objects](#simple-objects)\n      - [Complex objects](#complex-objects)\n      - [Big data](#big-data)\n      - [Circular objects](#circular-objects)\n      - [Special objects](#special-objects)\n  - [Development](#development)\n\n## Usage\n\n```javascript\nimport { copy } from 'fast-copy';\nimport { deepEqual } from 'fast-equals';\n\nconst object = {\n  array: [123, { deep: 'value' }],\n  map: new Map([\n    ['foo', {}],\n    [{ bar: 'baz' }, 'quz'],\n  ]),\n};\n\nconst copiedObject = copy(object);\n\nconsole.log(copiedObject === object); // false\nconsole.log(deepEqual(copiedObject, object)); // true\n```\n\n## Options\n\n#### isStrict\n\nStarting in `2.0.0`, you can use the `isStrict` option to copy the object based on strict standards, meaning:\n\n- Properties retain their original property descriptor\n- Non-enumerable properties are copied\n- Non-standard properties (e.g., keys on an `Array` object) are copied\n\nThis is significantly slower, so you should only use this if your use-case requires it.\n\n```javascript\nconsole.log(copy(object, { isStrict: true }));\n```\n\n**NOTE**: This option is also aliased as `copyStrict`.\n\n```javascript\nimport { copyStrict } from 'fast-copy';\n\nconsole.log(copyStrict(object));\n```\n\n#### realm\n\nUnder the hood, `fast-copy` uses `instanceof` to determine object types, which can cause false negatives when used in combination with `iframe`-based objects. To handle this edge case, you can pass the `realm` in options, which identifies which realm the object comes from and will use that realm to drive both comparisons and constructors for the copies.\n\n```html\n<iframe srcdoc=\"<script>var arr = ['foo', 'bar'];</script>\"></iframe>\n```\n\n```javascript\nconst iframe = document.querySelector('iframe');\nconst arr = iframe.contentWindow.arr;\n\nconsole.log(copy(arr, { realm: iframe.contentWindow })); // ['foo', 'bar']\n```\n\n## Types supported\n\nThe following object types are deeply cloned when they are either properties on the object passed, or the object itself:\n\n- `Array`\n- `ArrayBuffer`\n- `Blob`\n- `Buffer`\n- `DataView`\n- `Date`\n- `Float32Array`\n- `Float64Array`\n- `Int8Array`\n- `Int16Array`\n- `Int32Array`\n- `Map`\n- `Object`\n- `RegExp`\n- `Set`\n- `Uint8Array`\n- `Uint8ClampedArray`\n- `Uint16Array`\n- `Uint32Array`\n- `React` components\n- Custom constructors\n\nThe following object types are copied directly, as they are either primitives, cannot be cloned, or the common use-case implementation does not expect cloning:\n\n- `AsyncFunction`\n- `Boolean`\n- `Error`\n- `Function`\n- `GeneratorFunction`\n- `Number`\n- `Null`\n- `Promise`\n- `String`\n- `Symbol`\n- `Undefined`\n- `WeakMap`\n- `WeakSet`\n\nCircular objects are supported out of the box as well. By default a cache based on `WeakSet` is used, but if `WeakSet` is not available then a standard `Object` fallback is used. The benchmarks quoted below are based on use of `WeakSet`.\n\n## Benchmarks\n\n#### Simple objects\n\n_Small number of properties, all values are primitives_\n\n|                    | Operations / second |\n| ------------------ | ------------------- |\n| **fast-copy**      | **2,692,822**       |\n| clone              | 1,420,277           |\n| lodash.cloneDeep   | 1,277,213           |\n| fast-deepclone     | 768,982             |\n| ramda              | 719,948             |\n| fast-clone         | 567,342             |\n| deepclone          | 509,547             |\n| fast-copy (strict) | 420,804             |\n\n#### Complex objects\n\n_Large number of properties, values are a combination of primitives and complex objects_\n\n|                    | Operations / second |\n| ------------------ | ------------------- |\n| **fast-copy**      | **109,352**         |\n| fast-deepclone     | 101,808             |\n| ramda              | 93,103              |\n| deepclone          | 74,270              |\n| fast-clone         | 49,911              |\n| clone              | 46,355              |\n| lodash.cloneDeep   | 43,900              |\n| fast-copy (strict) | 33,440              |\n\n#### Big data\n\n_Very large number of properties with high amount of nesting, mainly objects and arrays_\n\n|                    | Operations / second |\n| ------------------ | ------------------- |\n| **fast-copy**      | 123                 |\n| fast-deepclone     | 101                 |\n| fast-clone         | 93                  |\n| lodash.cloneDeep   | 92                  |\n| deepclone          | 66                  |\n| clone              | 50                  |\n| fast-copy (strict) | 42                  |\n| ramda              | 5                   |\n\n#### Circular objects\n\n_Objects that deeply reference themselves_\n\n|                            | Operations / second |\n| -------------------------- | ------------------- |\n| **fast-copy**              | **1,143,074**       |\n| ramda                      | 750,430             |\n| clone                      | 722,632             |\n| lodash.cloneDeep           | 580,005             |\n| deepclone                  | 490,824             |\n| fast-deepclone             | 446,585             |\n| fast-copy (strict)         | 321,678             |\n| fast-clone (not supported) | 0                   |\n\n#### Special objects\n\n_Custom constructors, React components, etc_\n\n|                    | Operations / second |\n| ------------------ | ------------------- |\n| **fast-copy**      | **78,422**          |\n| clone              | 52,165              |\n| lodash.cloneDeep   | 39,648              |\n| ramda              | 32,372              |\n| fast-deepclone     | 27,518              |\n| fast-clone         | 27,495              |\n| deepclone          | 16,552              |\n| fast-copy (strict) | 12,509              |\n\n## Development\n\nStandard practice, clone the repo and `yarn` (or `npm i`) to get the dependencies. The following npm scripts are available:\n\n- benchmark => run benchmark tests against other equality libraries\n- build => run `build:files` and `build:types`\n- build:files => build dist files with `rollup`\n- build:types => build TypeScript types for consumers\n- clean => run `rimraf` on the `dist` folder\n- dev => start webpack playground App\n- dist => run `build` and `build:minified` scripts\n- lint => run ESLint on all files in `src` folder (also runs on `dev` script)\n- lint:fix => run `lint` script, but with auto-fixer\n- prepublishOnly => run `lint`, `test:coverage`, and `dist` scripts\n- release => run `prepublishOnly` and release with new version\n- release:beta => run `prepublishOnly` and release with new beta version\n- release:dry => run `prepublishOnly` and simulate a new release\n- start => run `dev`\n- test => run AVA with NODE_ENV=test on all files in `test` folder\n- test:coverage => run same script as `test` with code coverage calculation via `nyc`\n- test:watch => run same script as `test` but keep persistent watcher\n","readmeFilename":"README.md","gitHead":"d834f5827973b2aed8d2854afc5d2c10d90feefb","_id":"fast-copy@3.0.0-beta.2","_nodeVersion":"16.14.2","_npmVersion":"8.7.0","dist":{"integrity":"sha512-+8TWfccI0WqEM1/mtUWixt6wR4GchztbVTfPU2rciXVrvVINPtbmY6LFJtcysXJhpRwo6hp6rgqX6zEH5nVA4g==","shasum":"a191563e54aa7a10d402a89b07a73e3b0c747f4b","tarball":"http://registry-npm.ywwl.com/fast-copy/download/fast-copy-3.0.0-beta.2.tgz","fileCount":29,"unpackedSize":139140,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEcKbYNtgzL8b0WTc6MvGgU0DATCWUDP/mqSjbkRMVfsAiAEytU7gIIEh2NpULc3XHS85k6FxM93VGR0dgdc4d42sA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjL1mjACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqfkBAAm6lYuvmUNeQ9PbmvYdtE9FDFW0m2b78hT83VUlRg4RlmyeuH\r\n90YisJjyTSSNP2Qvg6dYcqlazKNQmBcZH4dc3HWoOL63ghD8ngudh7Nu8VrU\r\n2JbCjH4WBGM2GIVwrANvTFWTe4t4ryjSLR7uk1zTsCFTByOSSs5rKGEP7NMG\r\ngmcgaRVzh8+xs/lsOS4DGQK3mfFiZUODXzW33otGLsYw4UBh0NZe2uQjTx+w\r\nClTVPBFwkPan+FYaO4ZU2xx6fPgVOOhd/u1KZg63+WZBmhIu53GnNd8RVXU7\r\nMrRyJ+TlDDOH0ypoQa8BdO0Yn9CObWt0r3F8/7nycbKV3AKtDU43q+5BUGhx\r\nSYdtbmFedewJA+8UU6k2qUdd/yUEGgh/CAy600L1PAREZQ9XH/DBpFndVsT/\r\n9rCCtDnuDiR664T9S2b0mEeF/F5mOari3TBWvpduZ5fKZEInouOyAkib6isK\r\ne+ZbjCQHtYbpNmkbZsXAjzyT1g+YoLYKOLLBCHHHpJyKxrjM86VBfYe/KMaa\r\nlzgONnT5rz2SwyrFCRaPxtHkuUsKo3dBu+MYfotnBW9ggpv7KrHz+FO/ksFf\r\nw2EFc5JmnYvYC4cSBIy2EjofDz7Sgjwxnb0X2BglKgG3wJoZh6Hc+/xFBxym\r\nJeEa8wakmP9xEM3OA5PUy3qYARxOQUiGvlc=\r\n=qCjr\r\n-----END PGP SIGNATURE-----\r\n","size":23312,"noattachment":false,"key":"/fast-copy/-/fast-copy-3.0.0-beta.2.tgz"},"_npmUser":{"name":"planttheidea","email":"tony.quetano@planttheidea.com"},"directories":{},"maintainers":[{"name":"planttheidea","email":"tony.quetano@planttheidea.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fast-copy_3.0.0-beta.2_1664047522933_0.4710167832457648"},"_hasShrinkwrap":false,"publish_time":1664047523192,"_cnpm_publish_time":1664047523192,"dist-tags":{"latest":"4.3.1","latest-v2":"2.2.0","latest-v3":"3.1.0"}}