1.1.0 • Published 9 years ago

should-approximately-deep v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

should-approximately-deep

Extend should.js to assert arrays with approximate values

Installation

npm install should-approximately-deep --save-dev
require('should-approximately-deep');

Usage

approximatelyDeep(otherValue, delta)

Asserts if a chained object is a number or a (potentially multidimensional) array of numbers and that its values are near the ones from otherValue within the delta margin. Each array must have the same number of elements.

[1, 2, 3].should.be.approximatelyDeep([1, 2.01, 2.99], 0.1);
[1, 2, 3].should.not.be.approximatelyDeep([1, 2], 0.1);
[[1, 2, 3], [4, 5, 6]].should.be.approximatelyDeep([[1.05, 1.95, 3],[4, 4.98, 6]], 0.1);

License

MIT