Allow to specify empty bearings string in input parameters

This commit is contained in:
Michael Krasnyk 2017-11-11 11:26:41 -05:00
parent e805f85407
commit 3c3322173c

View File

@ -12,6 +12,10 @@ module.exports = {
FuzzyMatch: class { FuzzyMatch: class {
match (got, want) { match (got, want) {
// don't fail if bearings input and extected string is empty and actual result is undefined
if (want === '' && (got === '' || got === undefined))
return true;
var matchPercent = want.match(/(.*)\s+~(.+)%$/), var matchPercent = want.match(/(.*)\s+~(.+)%$/),
matchAbs = want.match(/(.*)\s+\+\-(.+)$/), matchAbs = want.match(/(.*)\s+\+\-(.+)$/),
matchRe = want.match(/^\/(.*)\/$/), matchRe = want.match(/^\/(.*)\/$/),