Minor Simplifications

This commit is contained in:
Nitish Kumar
2018-10-02 23:10:00 +05:30
parent bf35deabc8
commit ee5586c7f2
3 changed files with 22 additions and 44 deletions

View File

@ -8,14 +8,12 @@ Adapted from [here](https://github.com/forrestthewoods/lib_fts/blob/80f3f8c52db5
```js
const isSimilar = (pattern, str) =>
[...str].reduce(
(matchIndex, char) =>
char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()
? matchIndex + 1
: matchIndex,
0
) === pattern.length
? true
: false;
(matchIndex, char) =>
char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()
? matchIndex + 1
: matchIndex,
0
) === pattern.length;
```
```js