fix: Compare number using contains instead of equals (#67)

This commit is contained in:
Deepesh Garg 2019-05-23 12:51:18 +05:30 committed by Faris Ansari
parent e014960e97
commit b075fb5d71

View File

@ -106,6 +106,16 @@ function getFilterMethod(filter) {
return value >= values1[1] && value <= values2[1];
})
.map(cell => cell.rowIndex);
},
containsNumber(keyword, cells) {
return cells
.filter(cell => {
const hay = numberCompareValue(cell);
const needle = keyword;
return !needle || hay.toString().includes(needle);
})
.map(cell => cell.rowIndex);
}
};
@ -152,7 +162,7 @@ function guessFilter(keyword = '') {
if (isNumber(compareString)) {
return {
type: 'equals',
type: 'containsNumber',
text: parseInt(keyword, 10)
};
}