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

@ -1,11 +1,9 @@
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;
module.exports = isSimilar;