if token == toString the encoder errors out with this error.
https://github.com/latitudegames/GPT-3-Encoder/blob/master/Encoder.js#L163
Suggested fix: Cast token to string:
(toString).split(' ')
VM236:1 Uncaught TypeError: toString.split is not a function
at <anonymous>:1:12
('toString').split(' ')
['toString']
EDIT:
same issue occured with constructor. The encoder may struggle with all reserved JS keywords :/