It's a copy and paste from character-encoder, which in turn is a copy and paste from esprima, so I imagine the original reason is performance.  For our purposes an array and indexOf would probably be plenty fast enough though.