Merge branch 'master' of https://github.com/beatrichartz/jasmine into beatrichartz-master

- Merges #1362 from @beatrichartz
This commit is contained in:
Gregg Van Hove
2017-06-07 14:15:55 -07:00
3 changed files with 28 additions and 0 deletions

View File

@@ -15,6 +15,12 @@ getJasmineRequireObj().toBeCloseTo = function() {
precision = precision || 2;
}
if (expected === null || actual === null) {
throw new Error('Cannot use toBeCloseTo with null. Arguments evaluated to: ' +
'expect(' + actual + ').toBeCloseTo(' + expected + ').'
);
}
return {
pass: Math.abs(expected - actual) < (Math.pow(10, -precision) / 2)
};