if (
el.nextSibling.nodeName === "DIV" ||
el.nextSibling.nodeName === "P" ||
el.nextSibling.nodeName === "SPAN" ||
el.nextSibling.nodeName === "I" ||
el.nextSibling.nodeName === "B" ||
el.nextSibling.nodeName === "PRE" ||
el.nextSibling.nodeName === "CODE" ||
el.nextSibling.nodeName === "IMG"
) {...}
const names = [ 'DIV', 'P', 'SPAN', ... ];
if (names.includes(el.nextSibling.nodeName)) {
...
const hashes = [ DIV:1, P:1, SPAN:1, ... ];
if (hashes[el.nextSibling.nodeName]) {
...