{"name":"chai-exclude","version":"1.0.10","keywords":["chai","assert","expect","exclude","chai-plugin","chai-exclude"],"author":{"name":"Saugat Acharya","email":"mesaugat@gmail.com"},"license":"MIT","_id":"chai-exclude@1.0.10","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":"7a91a92ce305a4ed39eba7376fdb4069525e4c89","tarball":"http://registry-npm.ywwl.com/chai-exclude/download/chai-exclude-1.0.10.tgz","fileCount":6,"integrity":"sha512-0ydcWiIgpqhXUVRXlJrkl11EDX8BNSBjLXwom+DcNArsXzi89lOHQjKjfBG5WZTH/vKVGK867Bn3boq5A3y5+g==","signatures":[{"sig":"MEYCIQD7mxMuPM8d42svO4lvUfg2MPUwbB5pKjROfQsRnxnJiQIhAPWuaxy7huy6OsGlDEF7A4c4M9H8AhXj3vQMQnZfB4XA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":56619,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbvis0CRA9TVsSAnZWagAAUiQQAIYs0If/he6Pwq5Tpo5m\nD/NuTMpGlmuRF7c+Hpz861yDuIMGMAZpLqqYnUvVZ2H46GPGNj0zLGUvawSx\ndENXRTq+wE4ksncGwfnqgoGWdGCmAAW7DwYrYAhkKX1NUVIwo9ThfOxSUGyr\nKydvdyvCG0QEZLhp6rO7K/Ljzq08+N/6nXtcbMd5QI80ER6YbZokmQXkLWgS\nBYGZmqRFSn+YYOfyHdKqMEKMrnEp2wCttcfkBE1vfv/Ymt49RXRuCjSndh/f\nq9lgWNfqSRqoX+JYp9qh3PqaowDNlco2mLhZ+XeRwWaia1TfXxH45hYgOC9/\nEUbIbXwLWV/MYBXA5mgQPW1SXIL5A3I7zyow1tTSYYniIKdqFgFPFpy3CmsX\n5M1s5k5MvYMFZ8CddMWpk04zPUIX+5+y6onZ1rzaPZuY0RQW2QSNXyAl8qKx\nvBO9RxyyhEJus76ujZzyRTeCZFNOvzWbsN8Br3/vWfArSYmHWVOq47WUa1ty\nyYpGhr+9feevV87/r4iZuaixaJbLAueKNu7EkMni5LEQoDqFYeJEKdfFR1lp\nnmF5bkar6OwU8EStcZzpSNfkzORPD1kZlv/25A+1jm6rnJdAmuzBC4ZMivH7\n19EoSP1milyu1AX1iPSV8mLXs4ReAYgfQF5JSfiaf39o3RBUxlO3yfdad3Ge\nxCpO\r\n=lEZa\r\n-----END PGP SIGNATURE-----\r\n","size":16365,"noattachment":false,"key":"/chai-exclude/-/chai-exclude-1.0.10.tgz"},"main":"lib/chai-exclude.js","types":"lib/chai-exclude.d.ts","gitHead":"833c80f68577f4337353e7f6ff685260aba665dc","scripts":{"lint":"eslint lib test --fix","test":"mocha"},"_npmUser":{"name":"mesaugat","email":"mesaugat@gmail.com"},"repository":{"url":"git+https://github.com/mesaugat/chai-exclude.git","type":"git"},"_npmVersion":"6.4.1","description":"Exclude keys to compare from a deep equal operation with chai expect and assert","directories":{},"_nodeVersion":"8.11.1","dependencies":{"fclone":"^1.0.11"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.1.2","mocha":"^5.0.0","eslint":"^4.17.0","@types/chai":"^4.1.2","eslint-plugin-node":"^5.2.0","eslint-plugin-import":"^2.8.0","eslint-plugin-promise":"^3.6.0","eslint-config-standard":"^11.0.0-beta.0","eslint-plugin-standard":"^3.0.1"},"_npmOperationalInternal":{"tmp":"tmp/chai-exclude_1.0.10_1539189555889_0.4087992384378969","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":1539189556008,"_cnpm_publish_time":1539189556008,"dist-tags":{"latest":"3.0.1"}}