{"_id":"chai-almost","_rev":"6-2c7a736496578b2a2796a6d707f3d204","name":"chai-almost","description":"Extends chai with assertions that allow for floating point rounding errors","dist-tags":{"latest":"1.0.1"},"versions":{"0.1.0":{"name":"chai-almost","version":"0.1.0","description":"Extends chai with assertions that allow for floating point rounding errors","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/nmuldavin/chai-almost.git"},"author":{"name":"Noah Muldavin","email":"nmuldavin@gmail.com"},"license":"ISC","bugs":{"url":"https://github.com/nmuldavin/chai-almost/issues"},"homepage":"https://github.com/nmuldavin/chai-almost#readme","gitHead":"9ad2f46bc427705e0c89a6783835ec565b852168","_id":"chai-almost@0.1.0","_shasum":"2236d155beb6f9be3cb1a89c9c4c4548bc656fe5","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"nmuldavin","email":"nmuldavin@gmail.com"},"dist":{"shasum":"2236d155beb6f9be3cb1a89c9c4c4548bc656fe5","tarball":"https://registry.npmjs.org/chai-almost/-/chai-almost-0.1.0.tgz","integrity":"sha512-XTNeICbxSz+BD9kCiIbBUCs1qcnV/sJwWe98JRKakrCXpy4HEkryjE285Qxb1PUhnHR6s+/IvIobCKgx/kkeng==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCOLx/mNZW22J9kR9r74hScgkZ5g0/7r4mawdO+1FfC2gIhAI+mYmdbrENph8exkPp2hbhEHgsL/xoz/Ejb00prgz0I"}]},"maintainers":[{"name":"nmuldavin","email":"nmuldavin@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/chai-almost-0.1.0.tgz_1494636351655_0.9799163418356329"}},"0.9.0":{"name":"chai-almost","version":"0.9.0","description":"Extends chai with assertions that allow for floating point rounding errors","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/nmuldavin/chai-almost.git"},"author":{"name":"Noah Muldavin","email":"nmuldavin@gmail.com"},"license":"MIT","scripts":{"build":"babel src -d lib","test":"mocha test","test:watch":"mocha test -w"},"dependencies":{"deep-eql":"^2.0.2","type-detect":"^4.0.3"},"devDependencies":{"babel-cli":"^6.24.1","babel-preset-env":"^1.4.0","chai":"^3.5.0","eslint":"^3.19.0","eslint-config-standard":"^10.2.1","eslint-plugin-import":"^2.2.0","eslint-plugin-node":"^4.2.2","eslint-plugin-promise":"^3.5.0","eslint-plugin-standard":"^3.0.1","mocha":"^3.3.0"},"gitHead":"8dafa998d297e7fe0e59f67d93ddd5d95651153d","bugs":{"url":"https://github.com/nmuldavin/chai-almost/issues"},"homepage":"https://github.com/nmuldavin/chai-almost#readme","_id":"chai-almost@0.9.0","_shasum":"4a1c10e4bf4a26a4876f8dea0074c9954b1c54c0","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"nmuldavin","email":"nmuldavin@gmail.com"},"dist":{"shasum":"4a1c10e4bf4a26a4876f8dea0074c9954b1c54c0","tarball":"https://registry.npmjs.org/chai-almost/-/chai-almost-0.9.0.tgz","integrity":"sha512-WWhVDKt8oyV5X9f/cl8W5bLO+ObD6Hb91C6Np9Bz++IK07AAedNryYMqsAx5YHUET7Gp+kWQpAShyd/l2rymoQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2NekKd+ur/piBF3WRJFOha0kQIIn10pr3gHTjmByD+wIgFAfFwwzHk917SgWNLo5mHKpp47jaVxDieIfWMwoLRqQ="}]},"maintainers":[{"name":"nmuldavin","email":"nmuldavin@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/chai-almost-0.9.0.tgz_1494870881134_0.01294271880760789"}},"0.9.1":{"name":"chai-almost","version":"0.9.1","description":"Extends chai with assertions that allow for floating point rounding errors","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/nmuldavin/chai-almost.git"},"author":{"name":"Noah Muldavin","email":"nmuldavin@gmail.com"},"license":"MIT","scripts":{"build":"babel src -d lib","test":"mocha test","test:watch":"mocha test -w"},"dependencies":{"deep-eql":"^2.0.2","type-detect":"^4.0.3"},"devDependencies":{"babel-cli":"^6.24.1","babel-preset-env":"^1.4.0","chai":"^3.5.0","eslint":"^3.19.0","eslint-config-standard":"^10.2.1","eslint-plugin-import":"^2.2.0","eslint-plugin-node":"^4.2.2","eslint-plugin-promise":"^3.5.0","eslint-plugin-standard":"^3.0.1","mocha":"^3.3.0"},"gitHead":"1910fd85fb09b2717caf8155922ab33fec2750fd","bugs":{"url":"https://github.com/nmuldavin/chai-almost/issues"},"homepage":"https://github.com/nmuldavin/chai-almost#readme","_id":"chai-almost@0.9.1","_shasum":"1272e016c196a0a0213ad485b1ea122eec290cc2","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"nmuldavin","email":"nmuldavin@gmail.com"},"dist":{"shasum":"1272e016c196a0a0213ad485b1ea122eec290cc2","tarball":"https://registry.npmjs.org/chai-almost/-/chai-almost-0.9.1.tgz","integrity":"sha512-afuIxdeEZoyJGkixFDSCjW7DtWZcJ2fmkP9Hskw5guT3JVq9v/UcCDEwh7IZbNRFeTMASqIQYifTyVuWIqUzhQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBToBxhB+I/RUEmzK5mixABN0ZtOrs4k6+FMS+mX46RsAiBZ5WTV4DsL5lz1rOw0eDwlGUYigLD8fBdaSYTvv2aCWg=="}]},"maintainers":[{"name":"nmuldavin","email":"nmuldavin@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/chai-almost-0.9.1.tgz_1494871171525_0.04848666186444461"}},"1.0.0":{"name":"chai-almost","version":"1.0.0","description":"Extends chai with assertions that allow for floating point rounding errors","main":"index.js","repository":{"type":"git","url":"git+https://github.com/nmuldavin/chai-almost.git"},"author":{"name":"Noah Muldavin","email":"nmuldavin@gmail.com"},"license":"MIT","keywords":["tests","testing","chai","number-equality","assertions","assertion","chai-plugin","rounding-errors","approximation","testing-libraries","deep-equality"],"scripts":{"test":"mocha test","test:watch":"mocha test -w"},"dependencies":{"deep-eql":"^2.0.2","type-detect":"^4.0.3"},"devDependencies":{"chai":"^3.5.0","eslint":"^3.19.0","eslint-config-standard":"^10.2.1","eslint-plugin-import":"^2.2.0","eslint-plugin-node":"^4.2.2","eslint-plugin-promise":"^3.5.0","eslint-plugin-standard":"^3.0.1","mocha":"^3.3.0"},"gitHead":"d71cb9b2ada524ed5068085d0adaf0ea04f3a9e0","bugs":{"url":"https://github.com/nmuldavin/chai-almost/issues"},"homepage":"https://github.com/nmuldavin/chai-almost#readme","_id":"chai-almost@1.0.0","_shasum":"6f91bd6ce2724a35b0a96d9a52c935189a790d2b","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"nmuldavin","email":"nmuldavin@gmail.com"},"dist":{"shasum":"6f91bd6ce2724a35b0a96d9a52c935189a790d2b","tarball":"https://registry.npmjs.org/chai-almost/-/chai-almost-1.0.0.tgz","integrity":"sha512-a111DH7R+NFCHwCKEepyiih3VvKBdqurhbmKRvX0pfIqx1eYb9LSSYD8OfS/onNqhau60ORizUCZG0Lnd12l+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEXBxbE2tJb9jLES2FomCzdgBq91cCFoUcAE3PqPHdmTAiB8DFiWrJDbpH0zmAl5Di1HHVzuXxMggEFiCCpFRUNe3A=="}]},"maintainers":[{"name":"nmuldavin","email":"nmuldavin@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/chai-almost-1.0.0.tgz_1494889536062_0.5880783842876554"}},"1.0.1":{"name":"chai-almost","version":"1.0.1","description":"Extends chai with assertions that allow for floating point rounding errors","main":"index.js","repository":{"type":"git","url":"git+https://github.com/nmuldavin/chai-almost.git"},"author":{"name":"Noah Muldavin","email":"nmuldavin@gmail.com"},"license":"MIT","keywords":["tests","testing","chai","number-equality","assertions","assertion","chai-plugin","rounding-errors","approximation","testing-libraries","deep-equality"],"scripts":{"test":"mocha test","test:watch":"mocha test -w"},"dependencies":{"deep-eql":"^2.0.2","type-detect":"^4.0.3"},"devDependencies":{"chai":"^3.5.0","eslint":"^3.19.0","eslint-config-standard":"^10.2.1","eslint-plugin-import":"^2.2.0","eslint-plugin-node":"^4.2.2","eslint-plugin-promise":"^3.5.0","eslint-plugin-standard":"^3.0.1","mocha":"^3.3.0"},"gitHead":"e97bc30ec5db3de692a22491754ea69aa2f73e26","bugs":{"url":"https://github.com/nmuldavin/chai-almost/issues"},"homepage":"https://github.com/nmuldavin/chai-almost#readme","_id":"chai-almost@1.0.1","_shasum":"43d026cf3be79a1cd513cf15af840a81243a4b60","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"nmuldavin","email":"nmuldavin@gmail.com"},"dist":{"shasum":"43d026cf3be79a1cd513cf15af840a81243a4b60","tarball":"https://registry.npmjs.org/chai-almost/-/chai-almost-1.0.1.tgz","integrity":"sha512-UrNSx5f2B1/ESrOz0a4iLpDnQvDnK/3O0ZE/KGYQ+NcndKy0VQkMkv8yoGIHNSbjzKBid3EAMdDMA5wb9CxvSA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICjxGbRqBSmSnyEvO676xLgycki459AJW5Syl+zMxnUDAiEA3cbHndu9NXevoHWE+OJ9z0m+sPsCPG5nrPDvm16EzL8="}]},"maintainers":[{"name":"nmuldavin","email":"nmuldavin@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/chai-almost-1.0.1.tgz_1495031169060_0.42827018280513585"}}},"readme":"# chai-almost\n\n[![travis](https://travis-ci.org/nmuldavin/chai-almost.svg?branch=master)](https://travis-ci.org/nmuldavin/chai-almost)\n[![npm](https://img.shields.io/npm/v/chai-almost.svg)](https://www.npmjs.com/package/chai-almost)\n[![node](https://img.shields.io/badge/node-%3E=0.10-green.svg)](https://www.npmjs.com/package/chai-almost)\n\nExtends [chai](https://github.com/chaijs/chai) with assertions that allow numbers to be \"almost\" equal (as in, within some tolerance of one another). This is useful in particular when accounting for floating point rounding errors or other approximations.\n\n## Installation\n\n```\nnpm install chai-almost --save-dev\n```\n\n## Use\nTo use, import the module then invoke it with `chai.use`:\n\n```\nconst chai = require('chai');\nconst chaiAlmost = require('chai-almost');\n\nchai.use(chaiAlmost());\n```\n\nBy default, `chai-almost` allows a tolerance of 1 x 10<sup>-6</sup>. This will let most rounding errors pass safely but will still reject most true inequalities. You may override this value by passing your desired tolerance as an argument to the module on invocation:\n\n```\nchai.use(chaiAlmost(0.1));\n```\n\n### Assertions\n\nThe `almost` assertion may be used chainably with deep or shallow equality:\n\n```\n// shallow\nexpect(3.9999999).to.almost.equal(4);\t        // passes\nexpect(3.9).to.almost.equal(4);\t\t\t// fails\nexpect(4.0000001).to.be.almost(4);\t\t// passes\nexpect(4.1).to.not.be.almost(4);\t\t// passes\n\n// deep\nexpect({ taco: 'pastor', num: 3.9999999 }).to.almost.eql({ taco: 'pastor', num: 4 }); // passes\nexpect([[1, 2, 2.9999999], 1.0000001]).to.be.deep.almost([[1, 2, 3], 1]);             // passes\nexpect({ taco: 'pastor', num: 3.9 }).to.not.almost.eql({ taco: 'pastor', num: 4 });   // passes\n```\n\nEquality checks on non-numbers are left unchanged:\n\n```\nexpect('taco').to.almost.equal('taco');   // still passes\nexpect({ x: 5 }).to.be.almost({ x: 5 });  // still fails (shallow equality)\nexpect(['tacos', 2, 3]).to.be.deep.almost(['burritos', 2, 2.9999999]); // still fails\n```\n\n### Specific tolerance\n\nA single-instance custom tolerance for shallow or deep equality may be passed in as the second argument to `almost`:\n\n```\nexpect(10).to.be.almost(15, 10)                   // passes\nexpect([4, 2, 5]).to.be.deep.almost([3, 4, 7], 3) // passes\n```\n","maintainers":[{"name":"nmuldavin","email":"nmuldavin@gmail.com"}],"time":{"modified":"2022-06-13T05:50:46.131Z","created":"2017-05-13T00:45:53.398Z","0.1.0":"2017-05-13T00:45:53.398Z","0.9.0":"2017-05-15T17:54:41.376Z","0.9.1":"2017-05-15T17:59:33.890Z","1.0.0":"2017-05-15T23:05:38.159Z","1.0.1":"2017-05-17T14:26:11.407Z"},"homepage":"https://github.com/nmuldavin/chai-almost#readme","repository":{"type":"git","url":"git+https://github.com/nmuldavin/chai-almost.git"},"author":{"name":"Noah Muldavin","email":"nmuldavin@gmail.com"},"bugs":{"url":"https://github.com/nmuldavin/chai-almost/issues"},"license":"MIT","readmeFilename":"README.md","keywords":["tests","testing","chai","number-equality","assertions","assertion","chai-plugin","rounding-errors","approximation","testing-libraries","deep-equality"]}