10 lines
277 B
JavaScript
10 lines
277 B
JavaScript
const isSimilar = (pattern, str) =>
|
|
[...str].reduce(
|
|
(matchIndex, char) =>
|
|
char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()
|
|
? matchIndex + 1
|
|
: matchIndex,
|
|
0
|
|
) === pattern.length;
|
|
module.exports = isSimilar;
|