Files
30-seconds-of-code/test/isSimilar/isSimilar.js
Angelos Chalaris cc7b76d0b3 Test files linted
2018-08-03 10:39:26 +03:00

12 lines
280 B
JavaScript

const isSimilar = (pattern, str) =>
[...str].reduce(
(matchIndex, char) =>
char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()
? matchIndex + 1
: matchIndex,
0
) === pattern.length
? true
: false;
module.exports = isSimilar;