{"name":"klona","version":"2.0.2","repository":{"type":"git","url":"git+https://github.com/lukeed/klona.git"},"description":"A tiny (240B to 507B) and fast utility to \"deep clone\" Objects, Arrays, Dates, RegExps, and more!","module":"dist/index.mjs","unpkg":"dist/index.min.js","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./json":{"import":"./json/index.mjs","require":"./json/index.js"},"./lite":{"import":"./lite/index.mjs","require":"./lite/index.js"},"./full":{"import":"./full/index.mjs","require":"./full/index.js"},"./package.json":"./package.json"},"modes":{"json":"src/json.js","lite":"src/lite.js","default":"src/index.js","full":"src/full.js"},"engines":{"node":">= 8"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test -i suites"},"keywords":["clone","copy","deep","extend","recursive","object"],"devDependencies":{"bundt":"1.0.2","esm":"3.2.25","uvu":"0.3.3"},"gitHead":"43f298f5c34908bc1ca7959ed60cbd49f3e3b035","bugs":{"url":"https://github.com/lukeed/klona/issues"},"homepage":"https://github.com/lukeed/klona#readme","_id":"klona@2.0.2","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-SAJaH71R/V9+aQaUi0le3ouvAJP9ifSf6pGrbJJf5w+vwc7EHmaxBl43YO1Lv15BZHtfI03X7i20QLb87Hne4g==","shasum":"915044c0751e9fd503376c12343fe81d8f32b93c","tarball":"http://registry-npm.ywwl.com/klona/download/klona-2.0.2.tgz","fileCount":16,"unpackedSize":23250,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfOtHsCRA9TVsSAnZWagAAufIP/RJ+bo36f4NJnHXjHzXF\nQNs6wAnlS/NJgVPI9H8mOR/Q1Zg1y3Axb5vFbNPgPGVs0RuT/jgsZLATAOvh\ntuAU5DxKHQ5oc8qEhEnVBeZFluXbnspYKI/X8Q49pmsIgXzDbWMAU/+MrjpF\nwamQYfWsN+kPYFFzXLl39IOWv8jlqoKvyNEN9KF7ZKtsaBjEsrlg1xHMRDUO\nmD8JTQatHVPCoZqfEPNeSopiVIC6hW4/Fn5JMCKC+YPuC7/K9hB/F8AbAFWb\nMRE0nGlDFZn8CnXpgoGQXtM3+2E1KiQWyUQS0uAxDihHfprVsFjRB7mZ69X8\ntWND5wJVs8kzxQOdr9TqObT5B0S/CfuAtBQHYY+r5w5ldKsaCmlWHOd4Wyap\n6Uq9WCz2JrIbFC0pWayWlwxPoUhjkjnU48FQu8eKLzEwJM2qmDElK+ut85Dn\nZZQD6papflVE36CfebU1VDNjIZ0GR/cgNNL2L7tbVEo/tE4Tp5vuyCASZ+yU\n/fhXKDPEuHxoz0oakHqVfhswCYQpvX5djXzEwgjOv47xE+ywfwWQ1SAbsVhR\nD/b6QbnwhU5WzwzRXkXxBsBmudhFvd4LngnmIpM5fJlqc3CsjndOBoKHyzMD\nVkUweL8eNhpZmFMWySv8z1mrM1zElcQ87iLRWMV5EceXt9Y17pzhjfGiQHPJ\nT+I2\r\n=tLMO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFyvriIym5f1Lr8Ou9jAP1LHT2BzOSLcdn8ttENJ+cOlAiAvwQtOzsWjRvic49YOkeFCOGLSw9XWNnwmvmN+UxJX/g=="}],"size":6014,"noattachment":false,"key":"/klona/-/klona-2.0.2.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/klona_2.0.2_1597690348284_0.7003044584775215"},"_hasShrinkwrap":false,"readme":"<div align=\"center\">\n  <img src=\"logo.png\" alt=\"klona\" height=\"100\" />\n</div>\n\n<div align=\"center\">\n  <a href=\"https://npmjs.org/package/klona\">\n    <img src=\"https://badgen.now.sh/npm/v/klona\" alt=\"version\" />\n  </a>\n  <a href=\"https://github.com/lukeed/klona/actions\">\n    <img src=\"https://github.com/lukeed/klona/workflows/CI/badge.svg\" alt=\"CI\" />\n  </a>\n  <a href=\"https://npmjs.org/package/klona\">\n    <img src=\"https://badgen.now.sh/npm/dm/klona\" alt=\"downloads\" />\n  </a>\n  <a href=\"https://codecov.io/gh/lukeed/klona\">\n    <img src=\"https://codecov.io/gh/lukeed/klona/branch/master/graph/badge.svg?token=8ej0WeKqz7\" alt=\"codecov\" />\n  </a>\n</div>\n\n<div align=\"center\">A tiny (240B to 501B) and fast utility to \"deep clone\" Objects, Arrays, Dates, RegExps, and more!</div>\n\n\n## Features\n\n* Super tiny and [performant](#benchmarks)\n* Deep clone / recursive copies\n* Safely handles complex data types<br>\n    _Array, Date, Map, Object, RegExp, Set, TypedArray, and more_\n\nUnlike a \"shallow copy\" (eg, `Object.assign`), a \"deep clone\" recursively traverses a source input and copies its _values_ &mdash; instead of _references_ to its values &mdash; into a new instance of that input. The result is a structurally equivalent clone that operates independently of the original source and controls its own values.\n\n> **Why \"klona\"?** It's \"clone\" in Swedish.<br>\n> **What's with the sheep?** [Dolly](https://en.wikipedia.org/wiki/Dolly_(sheep)).\n\n\n## Install\n\n```\n$ npm install --save klona\n```\n\n\n## Modes\n\nThere are multiple \"versions\" of `klona` available, which allows you to bring only the functionality you need!\n\n#### `klona/json`\n> **Size (gzip):** 240 bytes<br>\n> **Availability:** [CommonJS](https://unpkg.com/klona/json/index.js), [ES Module](https://unpkg.com/klona/json/index.mjs), [UMD](https://unpkg.com/klona/json/index.min.js)<br>\n> **Ability:** JSON data types\n\n```js\nimport { klona } from 'klona/json';\n```\n\n#### `klona/lite`\n> **Size (gzip):** 354 bytes<br>\n> **Availability:** [CommonJS](https://unpkg.com/klona/lite/index.js), [ES Module](https://unpkg.com/klona/lite/index.mjs), [UMD](https://unpkg.com/klona/lite/index.min.js)<br>\n> **Ability:** extends `klona/json` with support for custom class, Date, and RegExp\n\n```js\nimport { klona } from 'klona/lite';\n```\n\n#### `klona`\n> **Size (gzip):** 451 bytes<br>\n> **Availability:** [CommonJS](https://unpkg.com/klona/dist/index.js), [ES Module](https://unpkg.com/klona/dist/index.mjs), [UMD](https://unpkg.com/klona/dist/index.min.js)<br>\n> **Ability:** extends `klona/lite` with support for Map, Set, DataView, ArrayBuffer, TypedArray\n\n```js\nimport { klona } from 'klona';\n```\n\n#### `klona/full`\n> **Size (gzip):** 501 bytes<br>\n> **Availability:** [CommonJS](https://unpkg.com/klona/full/index.js), [ES Module](https://unpkg.com/klona/full/index.mjs), [UMD](https://unpkg.com/klona/full/index.min.js)<br>\n> **Ability:** extends `klona` with support for Symbol properties and and non-enumerable properties\n\n```js\nimport { klona } from 'klona/full';\n```\n\n\n## Usage\n\n```js\nimport { klona } from 'klona';\n\nconst input = {\n  foo: 1,\n  bar: {\n    baz: 2,\n    bat: {\n      hello: 'world'\n    }\n  }\n};\n\nconst output = klona(input);\n\n// exact copy of original\nassert.deepStrictEqual(input, output);\n\n// applying deep updates...\noutput.bar.bat.hola = 'mundo';\noutput.bar.baz = 99;\n\n// ...doesn't affect source!\nconsole.log(\n  JSON.stringify(input, null, 2)\n);\n// {\n//   \"foo\": 1,\n//   \"bar\": {\n//     \"baz\": 2,\n//     \"bat\": {\n//       \"hello\": \"world\"\n//     }\n//   }\n// }\n```\n\n\n## API\n\n### klona(input)\nReturns: `typeof input`\n\nReturns a deep copy/clone of the input.\n\n\n## Benchmarks\n\n> Running Node v12.18.3\n\nThe benchmarks can be found in the [`/bench`](/bench) directory. They are separated into multiple categories:\n\n* `JSON` – compares an array of objects comprised of JSON data types (`String`, `Number`, `null`, `Array`, `Object`)\n* `LITE` – like `JSON`, but adds `RegExp`, `Date` and `undefined` values\n* `DEFAULT` – object with `RegExp`, `Date`, `Array`, `Map`, `Set`, custom class, `Int8Array`, `DataView`, `Buffer` values\n* `FULL` – like `DEFAULT`, but adds `Symbol` and non-enumerable properties\n\n> **Important:** Only candidates that pass validation step(s) are listed. <br>However, `lodash` and `clone` are kept to highlight important differences.\n\n> **Note:** The `clone/include` candidate refers to its [`includeNonEnumerable` option](https://www.npmjs.com/package/clone#api) enabled.\n\n```\nLoad times:\n  lodash/clonedeep   29.257ms\n  rfdc                0.511ms\n  clone               0.576ms\n  clone-deep          2.494ms\n  deep-copy           0.451ms\n  klona/full          0.408ms\n  klona               0.265ms\n  klona/lite          0.308ms\n  klona/json          0.263ms\n\nBenchmark :: JSON\n  JSON.stringify      x   53,899 ops/sec ±0.76% (92 runs sampled)\n  lodash              x   46,800 ops/sec ±0.86% (90 runs sampled)\n  rfdc                x  221,456 ops/sec ±0.88% (92 runs sampled)\n  clone               x   39,537 ops/sec ±0.68% (92 runs sampled)\n  clone/include       x   25,488 ops/sec ±1.06% (88 runs sampled)\n  clone-deep          x   99,998 ops/sec ±0.91% (93 runs sampled)\n  deep-copy           x  141,270 ops/sec ±0.95% (92 runs sampled)\n  klona/full          x   55,016 ops/sec ±0.68% (94 runs sampled)\n  klona               x  281,215 ops/sec ±0.77% (93 runs sampled)\n  klona/lite          x  318,481 ops/sec ±0.72% (91 runs sampled)\n  klona/json          x  334,932 ops/sec ±0.66% (93 runs sampled)\n\nBenchmark :: LITE\n  lodash              x   36,992 ops/sec ±0.65% (91 runs sampled)\n  clone               x   35,974 ops/sec ±1.13% (88 runs sampled)\n  clone/include       x   22,609 ops/sec ±1.02% (91 runs sampled)\n  clone-deep          x   92,846 ops/sec ±0.66% (93 runs sampled)\n  klona/full          x   47,873 ops/sec ±0.83% (88 runs sampled)\n  klona               x  226,638 ops/sec ±1.16% (93 runs sampled)\n  klona/lite          x  257,900 ops/sec ±0.82% (93 runs sampled)\n\nBenchmark :: DEFAULT\n  lodash              x   55,914 ops/sec ±0.75% (93 runs sampled)\n    ✘ Buffer\n    ✘ Map keys\n  clone               x   92,127 ops/sec ±0.83% (94 runs sampled)\n    ✘ DataView\n  clone/include       x   62,052 ops/sec ±0.88% (93 runs sampled)\n    ✘ DataView\n  klona/full          x   90,308 ops/sec ±0.68% (89 runs sampled)\n  klona               x  230,257 ops/sec ±0.71% (91 runs sampled)\n\nBenchmark :: FULL\n  lodash              x   60,361 ops/sec ±0.65% (91 runs sampled)\n    ✘ Buffer\n    ✘ Map keys\n    ✘ Missing non-enumerable Properties\n  clone/include       x   47,263 ops/sec ±0.85% (93 runs sampled)\n    ✘ DataView\n    ✘ Incorrect non-enumerable Properties\n  klona/full          x   82,346 ops/sec ±0.62% (93 runs sampled)\n```\n\n\n## Related\n\n* [dlv](https://github.com/developit/dlv) – safely **read** from deep properties in 120 bytes\n* [dset](https://github.com/lukeed/dset) – safely **write** into deep properties in 160 bytes\n* [dequal](https://github.com/lukeed/dequal) – safely check for deep equality in 304 to 489 bytes\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","publish_time":1597690348427,"_cnpm_publish_time":1597690348427,"dist-tags":{"latest":"2.0.6"}}