{"name":"chai-exclude","version":"2.0.1","keywords":["chai","assert","expect","exclude","chai-plugin","chai-exclude"],"author":{"name":"Saugat Acharya","email":"mesaugat@gmail.com"},"license":"MIT","_id":"chai-exclude@2.0.1","maintainers":[{"name":"mesaugat","email":"mesaugat@gmail.com"}],"homepage":"https://github.com/mesaugat/chai-exclude","bugs":{"url":"https://github.com/mesaugat/chai-exclude/issues"},"dist":{"shasum":"43e474a2a055d5efa414efcae30a91761148809c","tarball":"http://registry-npm.ywwl.com/chai-exclude/download/chai-exclude-2.0.1.tgz","fileCount":5,"integrity":"sha512-9cZ0ZzlGRwZvNiKUPTbx4E1anQ4aTqtKOX96+cb4XrNa+8B5KNZg3d43clYNawgXgBcQAenXeX5fbeY7+TdkrA==","signatures":[{"sig":"MEUCIAgZxYJDGXMnwawXc2X+FHfq4bhhzLVk235vBuAU+boIAiEApZuTjZrt2YhB6/Z0hdusCXqoHBsgCLyInzCdUg7pt6I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13585,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJchjOpCRA9TVsSAnZWagAAcX4P/09qjhtjZPaq8YRaPFAU\nQKIUXZlgKR+ZRKY+cKLXKg7qU/eB14VT/PcLyzSsZhMEief/GQvkD3v4GK6k\nDBMNEeZbQ4t+C/4pii6FGulYMYR9+ceLtXTLAxmzJfcWpIsNxXuCc/1fZWOP\nzCKX/F0ZPA9z8JVL0dfOx1qYO9V0QiucQz/ZVEBou7N+bIpY7K410vbSRrpo\nZH9fFALO7GFVTISnujZtSXRmjPa0gRQZyJCWcuAc9NjRUsdsc+7RROJ0pyYO\nV56cSIyaeskehAn871SfjOq56TpVdJcok31QtP+kjPbsuOlFMhKrxMgUo+Tl\n1awh7vv0RARUbYUXgjt1csTnJ9oef0VBKZ9pAKklrgprZBOcZT0lPfa5jL9A\nxciZAIzrtUFHGIcKYQk3FXJ9BZ71fUZHGW1dF9ey+X12qr+dfa5jxFmQShn+\nhsQd0qcSyTHQmIYrIrOTlAv74T5wg9j7saYX6g7HGM0cj8DgdJWEhL2tC+e+\nvBOQ+xB0mPyhvTUEUoKspEfI8T2aFxsAQK4/I+iqaShO3jwWbRY+6J7k2dK/\nUiCZgwKUBr15J6DAwCvHIFOojbS9gtn4XhTzERqgwuWsK8awANBqmhUYdNcg\nmgKLIoHRo+ULSw0X4mn+waRr7DWViTzWdn4498s/BXZUIwMdVx0qPMrrgTz4\n4Ejz\r\n=JdJO\r\n-----END PGP SIGNATURE-----\r\n","size":4046,"noattachment":false,"key":"/chai-exclude/-/chai-exclude-2.0.1.tgz"},"main":"chai-exclude.js","types":"index.d.ts","gitHead":"ef4e8e6ec597a1308fa2bb89d97c59a31c8f1cae","scripts":{"lint":"standard --fix","test":"mocha --reporter spec --recursive --colors *.test.js && tsd-check","typecheck":"tsd-check"},"_npmUser":{"name":"mesaugat","email":"mesaugat@gmail.com"},"repository":{"url":"git+https://github.com/mesaugat/chai-exclude.git","type":"git"},"_npmVersion":"6.7.0","description":"Exclude keys to compare from a deep equal operation with chai expect and assert","directories":{},"_nodeVersion":"8.12.0","dependencies":{"fclone":"^1.0.11"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.1.2","mocha":"^5.0.0","standard":"^12.0.1","tsd-check":"^0.3.0","@types/chai":"^4.1.2"},"peerDependencies":{"chai":">= 4.0.0 < 5"},"_npmOperationalInternal":{"tmp":"tmp/chai-exclude_2.0.1_1552298921379_0.8253685294145925","host":"s3://npm-registry-packages"},"readme":"# chai-exclude\n\n[![npm](https://img.shields.io/npm/v/chai-exclude.svg)](https://www.npmjs.com/package/chai-exclude)\n[![npm](https://img.shields.io/npm/dw/chai-exclude.svg)](https://www.npmjs.com/package/chai-exclude)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![CI Status](https://github.com/mesaugat/chai-exclude/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/mesaugat/chai-exclude/actions/workflows/test.yml)\n\nExclude keys to compare from a deep equal operation with chai [expect](http://chaijs.com/api/bdd/) or [assert](http://chaijs.com/api/assert/).\n\n## Why?\n\nSometimes you'll need to exclude object properties that generate unique values while doing a deep equal operation. This plugin makes it easier to remove those properties from comparison.\n\nWorks with both objects and array of objects with or without circular references.\n\n## Installation\n\n```bash\nnpm install chai-exclude --save-dev\n```\n\n```bash\nyarn add chai-exclude --dev\n```\n\n## Usage\n\n### Require\n\n```js\nconst chai = require('chai');\nconst chaiExclude = require('chai-exclude');\n\nchai.use(chaiExclude);\n```\n\n### ES6 Import\n\n```js\nimport chai from 'chai';\nimport chaiExclude from 'chai-exclude';\n\nchai.use(chaiExclude);\n```\n\n### TypeScript\n\n```js\nimport * as chai from 'chai';\nimport chaiExclude from 'chai-exclude';\n\nchai.use(chaiExclude);\n\n// The typings for chai-exclude are included with the package itself.\n```\n\n## Examples\n\nAll these examples are for JavaScript. If you are using TypeScript and `assert`, you'll need to deal with strict types. Take a look at the [type definition](index.d.ts).\n\n### a) excluding\n\n1. Excluding a top level property from an object\n\n```js\n// Object\nassert.deepEqualExcluding({ a: 'a', b: 'b' }, { b: 'b' }, 'a')\nassert.deepEqualExcluding({ a: 'a', b: 'b' }, { a: 'z', b: 'b' }, 'a')\n\nexpect({ a: 'a', b: 'b' }).excluding('a').to.deep.equal({ b: 'b' })\nexpect({ a: 'a', b: 'b' }).excluding('a').to.deep.equal({ a: 'z', b: 'b' })\n\n// Array\nassert.deepEqualExcluding([{ a: 'a', b: 'b' }], [{ b: 'b' }], 'a')\nassert.deepEqualExcluding([{ a: 'a', b: 'b' }], [{ a: 'z', b: 'b' }], 'a')\n\nexpect([{ a: 'a', b: 'b' }]).excluding('a').to.deep.equal([{ b: 'b' }])\nexpect([{ a: 'a', b: 'b' }]).excluding('a').to.deep.equal([{ a: 'z', b: 'b' }])\n```\n\n2. Excluding multiple top level properties from an object\n\n```js\nconst obj = {\n  a: 'a',\n  b: 'b',\n  c: {\n    d: 'd',\n    e: 'e'\n  }\n}\n\n// Object\nassert.deepEqualExcluding(obj, { b: 'b' }, ['a', 'c'])\nassert.deepEqualExcluding(obj, { a: 'z', b: 'b' }, ['a', 'c'])\n\nexpect(obj).excluding(['a', 'c']).to.deep.equal({ b: 'b' })\nexpect(obj).excluding(['a', 'c']).to.deep.equal({ a: 'z', b: 'b' })\n\nconst array = [\n  {\n    a: 'a',\n    b: 'b',\n    c: {\n      d: 'd',\n      e: 'e'\n    }\n  }\n]\n\n// Array\nassert.deepEqualExcluding(array, [{ b: 'b' }], ['a', 'c'])\nassert.deepEqualExcluding(array, [{ a: 'z', b: 'b' }], ['a', 'c'])\n\nexpect(array).excluding(['a', 'c']).to.deep.equal([{ b: 'b' }])\nexpect(array).excluding(['a', 'c']).to.deep.equal([{ a: 'z', b: 'b' }])\n```\n\n### b) excludingEvery\n\n1. Excluding every property in a deeply nested object\n\n```js\nconst actualObj = {\n  a: 'a',\n  b: 'b',\n  c: {\n    a: 'a',\n    b: {\n      a: 'a',\n      d: {\n        a: 'a',\n        b: 'b',\n        d: null\n      }\n    }\n  },\n  d: ['a', 'c']\n}\n\nconst actualArray = [actualObj]\n\nconst expectedObj = {\n  a: 'z',     // a is excluded from comparison\n  b: 'b',\n  c: {\n    b: {\n      d: {\n        b: 'b',\n        d: null\n      }\n    }\n  },\n  d: ['a', 'c']\n}\n\nconst expectedArray = [expectedObj]\n\n// Object\nassert.deepEqualExcludingEvery(actualObj, expectedObj, 'a')\nexpect(actualObj).excludingEvery('a').to.deep.equal(expectedObj)\n\n// Array\nassert.deepEqualExcludingEvery(actualArray, expectedArray, 'a')\nexpect(actualArray).excludingEvery('a').to.deep.equal(expectedArray)\n```\n\n2. Excluding multiple properties in a deeply nested object\n\n```js\nconst actualObj = {\n  a: 'a',\n  b: 'b',\n  c: {\n    a: 'a',\n    b: {\n      a: 'a',\n      d: {\n        a: 'a',\n        b: 'b',\n        d: null\n      }\n    }\n  },\n  d: ['a', 'c']\n}\n\nconst actualArray = [actualObj]\n\nconst expectedObj = {\n  b: 'b',\n  c: {\n    b: {\n    }\n  }\n}\n\nconst expectedArray = [expectedObj]\n\n// Object\nassert.deepEqualExcludingEvery(actualObj, expectedObj, ['a', 'd'])\nexpect(actualObj).excludingEvery(['a', 'd']).to.deep.equal(expectedObj)\n\n// Array\nassert.deepEqualExcludingEvery(actualArray, expectedArray, ['a', 'd'])\nexpect(actualArray).excludingEvery(['a', 'd']).to.deep.equal(expectedArray)\n```\n\n## Contributing\n\nContributions are welcome. If you have any questions create an issue [here](https://github.com/mesaugat/chai-exclude/issues).\n\n## License\n\n[MIT](LICENSE)\n","publish_time":1552298921488,"_cnpm_publish_time":1552298921488,"dist-tags":{"latest":"3.0.1"}}