Skip to content

Commit

Permalink
fix: Compare number using contains instead of equals (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepeshgarg007 authored and netchampfaris committed May 23, 2019
1 parent e014960 commit b075fb5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/filterRows.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down Expand Up @@ -152,7 +162,7 @@ function guessFilter(keyword = '') {

if (isNumber(compareString)) {
return {
type: 'equals',
type: 'containsNumber',
text: parseInt(keyword, 10)
};
}
Expand Down

0 comments on commit b075fb5

Please sign in to comment.