The following switch case appears to be dead code — the STATE_IGNORE_CDATA branch never runs because nothing sets the state to STATE_IGNORE_CDATA:
case STATE_IGNORE_CDATA: {
// if we're looping through a CDATA, fast-forward using
// indexOf to the first end-CDATA character ]]>
const endCDATA = data.indexOf("]]>", pos);
if (endCDATA !== -1) {
pos = endCDATA + 2; // target the '>' character
}
break;
}
The following switch case appears to be dead code — the STATE_IGNORE_CDATA branch never runs because nothing sets the state to STATE_IGNORE_CDATA: