When running diff like const diff = await htmlDiffer.diffHtml(oldHtml, newHtml); where both params are strings, then Promise.all in
|
parser.on('end', async function() { |
|
const values = await Promise.all(modifiedValues); |
|
resolve(values.join('')); |
is not necessary, because
modifiedValues is just an array of string, i.e. it may be simplified to
resolve(modifiedValues.join(''));.
Furthermore, whole modify may by synchronous by omitting that parser.on('end', ...) handler and just returning modifiedValues.join('') at the end of the function. So, even HtmlDiffer.diffHtml may be synchronous. Is there any use case or reason why it's async? I can make a PR to simplify it and make it synchronous.