Remove an extra layer of wrapping for matchers/custom matchers
Helps reduce how nested custom matchers have to be for users as well as Jasmine internal matchers [#59161378]
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
getJasmineRequireObj().toBeCloseTo = function() {
|
||||
|
||||
function toBeCloseTo() {
|
||||
return {
|
||||
compare: function(actual, expected, precision) {
|
||||
if (precision !== 0) {
|
||||
precision = precision || 2;
|
||||
}
|
||||
|
||||
return {
|
||||
pass: Math.abs(expected - actual) < (Math.pow(10, -precision) / 2)
|
||||
};
|
||||
return function(actual, expected, precision) {
|
||||
if (precision !== 0) {
|
||||
precision = precision || 2;
|
||||
}
|
||||
|
||||
return {
|
||||
pass: Math.abs(expected - actual) < (Math.pow(10, -precision) / 2)
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user