{"name":"clones","version":"1.2.0","description":"should deep clone everything even global objects, functions, circularities, ...","keywords":["circular","clone","deep-clone","global"],"bugs":{"url":"https://github.com/commenthol/clones/issues"},"repository":{"type":"git","url":"git+https://github.com/commenthol/clones.git"},"license":"MIT","author":{"name":"commenthol","email":"commenthol@gmail.com"},"main":"lib","jsnext:main":"src","directories":{"test":"test"},"scripts":{"all":"npm run clean && npm run lint && npm run transpile && npm test","clean":"rimraf lib","coverage":"nyc -r html -r text npm test","karma":"karma start","lint":"eslint --fix \"**/*.js\"","prepublishOnly":"npm run all","test":"mocha","transpile":"babel -d lib src","zuul":"zuul --no-coverage --local 3000 -- test/*.js"},"dependencies":{},"devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.2.2","@babel/preset-env":"^7.2.3","babel-loader":"^8.0.4","eslint":"^5.11.1","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.14.0","eslint-plugin-node":"^8.0.0","eslint-plugin-promise":"^4.0.1","eslint-plugin-standard":"^4.0.0","karma":"^3.1.4","karma-chrome-launcher":"^2.0.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.0.0","karma-mocha":"^1.3.0","karma-sourcemap-loader":"^0.3.7","karma-spec-reporter":"~0.0.32","karma-webpack":"^3.0.5","mocha":"^5.2.0","nyc":"^13.1.0","rimraf":"^2.5.4","webpack":"^4.28.3","zuul":"^3.11.1"},"engines":{"node":">=4.0.0"},"gitHead":"dd9d357948c949bd10a818d1f36e64b4d89c35b4","homepage":"https://github.com/commenthol/clones#readme","_id":"clones@1.2.0","_npmVersion":"6.5.0-next.0","_nodeVersion":"11.6.0","_npmUser":{"name":"commenthol","email":"commenthol@gmail.com"},"dist":{"integrity":"sha512-FXDYw4TjR8wgPZYui2LeTqWh1BLpfQ8lB6upMtlpDF6WlOOxghmTTxWyngdKTgozqBgKnHbTVwTE+hOHqAykuQ==","shasum":"b34c872045446a9f264ccceb7731bca05c529b71","tarball":"http://registry-npm.ywwl.com/clones/download/clones-1.2.0.tgz","fileCount":5,"unpackedSize":18283,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcK9D1CRA9TVsSAnZWagAA2K8P/09foujuxiPyLEbPND78\nTpWDqwjA8TqPdblcRODhH9D4iC6q90OI4/6ZFVwdKVhcP0yHgUz4x2QZeYP0\nH9jYoJaXbtZ0/+tzaXZ4LariJ/Dd1tzVzsWAMErrJ5ML6T+NEkrizODXQMSa\ntl7PaNfxkM7SssWTeSCWukcRu9KqWikkVfdbWYz0auUNDHCod6H8YH+7d2NL\nfg7r+WoQmFESzGy8YnumtBlLa0ARs1fP1Pc3V2qWunzoSAbxctwyiq2RVsvL\nDmmwt36dVLEX6tSuSKTsevJ7x6QuC9G9Olj5neGOeuuQNWGjDuuUVvU9sAgk\na1ELXPxo0AnwyziSfRvV/sTBvAaLae0VobpTBXdI19+Qy97dPLRJgImoHZlq\nDCIX7x7uqmVD2xNxdqNMvxJAqCfMcVqYWAo81clh4h4XeKgKqPqIR8gR4AR+\nEvaG8IXSEdom6R2p4Ze42DZtXHxzU+Pi6g5qyxsLUJGX39oA9I4hUqUJyifT\npBuTAAlT60zMG0a/RQbA4mJiRzS4QJfAYa/3CuXVDO7ECawyChaqoa/xfTNk\nePahyCBt/ySs5Rk6FO8oCt6JHX6j27DaiKgjN+RYzyRfrqVfq3YvvY1Z5X4e\nqa2oGteG4lNr+CJaJi0jXmicyqITXWFrxZy2MYaK2CkzTpGaGKgBooTlNw5Y\njrkP\r\n=rmhN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCrDpXiY4ZjQ/68SEQ7swTOW9pHaw15o3rfseqtyjcSYAIgb9V3QpnpYTWdAJdR4668oBkrQJg5RUd/w836X/oZ71I="}],"size":4802,"noattachment":false,"key":"/clones/-/clones-1.2.0.tgz"},"maintainers":[{"name":"commenthol","email":"commenthol@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/clones_1.2.0_1546375412613_0.48791962789012855"},"_hasShrinkwrap":false,"readme":"# clones\n\n[![NPM version](https://badge.fury.io/js/clones.svg)](https://www.npmjs.com/package/clones/)\n\n> should deep clone everything even global objects, functions, circularities, ...\n\nCompanion for [safer-eval](https://github.com/commenthol/safer-eval).\n\nRuns on node and in modern browsers:\n\n|                | Versions |\n| ---            | ---      |\n| **node**       | ~~0.12~~, 4, 6, 8, 10, 11  |\n| **Chrome**     | 55, 56, 71 |\n| **Firefox**    | 45, 51, 64 |\n| **Edge**       | 14, 16   |\n| **IE**         | ~~11~~   |\n| **Safari**     | 10       |\n| **iOS Safari** | 10       |\n\n## Installation\n\n```\nnpm i -S clones\n```\n\n## Usage\n\n```js\nconst clones = require('clones')\nconst dest = clones(source, [bind])\n```\n\n**Parameters**\n\n**Parameters**\n\n**source**: `Object`, clone source\n\n**bind**: `Object`, bind functions to this context\n\n**Returns**: `Any`, deep clone of `source`\n\n**Example**:\n```js\nconst clones = require('clones')\n\nvar source = {\n  obj: {a: {b: 1}},\n  arr: [true, 1, {c: 'dee'}],\n  fn: function () { return this.number + 12 }\n}\n// adding circularity\nsource.obj.a.e = source.obj.a\n\n// do the cloning (with binding a context)\nvar dest = clones(source, {number: 30})\n// => { obj: { a: { b: 1, e: [Circular] }, d: 2017-02-17T21:57:44.576Z },\n//      arr: [ true, 1, { c: 'dee' } ],\n//      fn: [Function: fn] }\n\n// checks\nassert.ok(dest !== source)                      // has different reference\nassert.ok(dest.obj !== source.obj)              // has different reference\nassert.ok(dest.obj.a !== source.obj.a)          // has different reference\nassert.ok(dest.obj.a.e !== source.obj.a.e)      // different references for circularities\nassert.equal(dest.obj.d.toISOString(),\n  source.obj.d.toISOString())                   // has same content\nassert.ok(dest.fn !== source.fn)                // has different function reference\nsource.fn = source.fn.bind({number: 29})        // bind `this` for `source`\nassert.equal(dest.fn(), source.fn() + 1)        // returning the same result\n```\n\n### Clone prototypes or classes\n\n```js\nconst clones = require('clones')\n// clone built in `Array`\nconst C = clones.classes(Array)\n\nlet c = new C(1,2,3)\n// => [1, 2, 3]\nc.reverse()\n// => [3, 2, 1]\n```\n\n## License\n\n[MIT](./LICENSE)\n","publish_time":1546375412762,"_cnpm_publish_time":1546375412762,"dist-tags":{"latest":"1.2.0"}}