{"name":"klona","version":"1.1.0","repository":{"type":"git","url":"git+https://github.com/lukeed/klona.git"},"description":"A tiny (281B) and fast utility to \"deep clone\" Objects, Arrays, Dates, RegExps, and more!","module":"dist/klona.mjs","unpkg":"dist/klona.min.js","main":"dist/klona.js","types":"klona.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">= 8"},"scripts":{"build":"bundt","pretest":"npm run build","test":"tape -r esm test/*.js | tap-spec"},"keywords":["clone","copy","deep","extend","recursive","object"],"devDependencies":{"bundt":"0.4.0","esm":"3.2.25","tap-spec":"5.0.0","tape":"4.13.0"},"gitHead":"c969b506c4ecf5677050b671ae65e87e49f4facb","bugs":{"url":"https://github.com/lukeed/klona/issues"},"homepage":"https://github.com/lukeed/klona#readme","_id":"klona@1.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-GFUbhEGUECp2Nx3cCLG7yMm8cgHNfHndn87mFxhp5bPrsHYfycgs6BPvML1CxOGiuQC3zNclabg0AFO2F1NvOA==","shasum":"3818fbcb4ed1637cadadd09a89f6a28e4248a573","tarball":"http://registry-npm.ywwl.com/klona/download/klona-1.1.0.tgz","fileCount":7,"unpackedSize":7471,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeF7S/CRA9TVsSAnZWagAAbJAP/R4TC4qgcna574tBZiRQ\nc+q3mDuOxusg7tLZ5DjapPnOh/L1HRRSiU9UNYEBooHX6mg2DhkZha6IGbqv\n0QfKSsicDA8naVzO2pOSV26yU8Y3s5vY+nIHYxw261NZwLl54/EKTjgLVbab\nXaTQmY9nM64o0WMBw6EmH50WCAAuJ5EgkpF5YsBV8Dljv+6KxhzFLp1LABXZ\nczMhK+1iFhr4sS+Nk+FAs5/rYXbAbrAjBmbJ0kYAaA/sLq33glJ9c7TY2i9i\nYosntj10KTo28gmeiT002W7s0fc3KG2lnMOldKMi/121Ke2YkF4sH3NLI58m\nRL/k1mHRuW07ifFb5an6eHlFMuvErG+EPbCTHw0tBwvAHFnqyKmQjs5klDbT\nAzM09ayQgDrmSGiD29Gz1KGzWm/SRk0O6d0zJqWLElAaqifkouPxrtp/JlyH\n+yHUSJ3eR9zmhxABtNuaR7UpLMbDLagwN5ccigAw1ufbwAdnDMuWNQC4upiL\nh8sbqoF8NGcCYYi6hZDMaXHFiwDqHzINjs1yU0VLrq4AXNYNROmmoQqGtB/4\ncVXQGYGDD1BIubbG+s2AkZDBojKYc/lERLSv8Gj8sJcgvPsxKD8MXYibTkTK\nN6pHb/5vL1Zzj8xa2u9rgrFvU7BaFJk/Lvjq0GLp+XhPC8Qtio3ux5ePkq/L\nWe/F\r\n=2M9E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCXQgiLGm9eZQxko3UuNIPk/4jDVTf2l0T6UKmOODYSowIhANmPuJSFUUskqfGtXBYrzQy+FJk2GQwsaCmoR2DMoBip"}],"size":3295,"noattachment":false,"key":"/klona/-/klona-1.1.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/klona_1.1.0_1578611902613_0.8293396064797571"},"_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":1578611902690,"_cnpm_publish_time":1578611902690,"dist-tags":{"latest":"2.0.6"}}