- Get some help:
iex> i 'hello'
Term
iex> i 'hello'
Term
function subMatches(string, subs) { | |
return [] | |
.concat.apply([], subs.map(sub => matchIndexes(string, sub))) | |
.reduce((acc, idx) => { | |
acc[idx] = true; | |
return acc; | |
}, Array.from(string).fill(false)); | |
} | |
function matchIndexes(string, sub, startIndex=0, matches=[]) { |