Closed lapinskicho closed 6 years ago
he.decode
only accepts strings by design.
The fix is to change the code that’s calling he.decode
to ensure it converts the argument into a string, e.g.
- this.push(he.decode(data));
+ this.push(he.decode(String(data)));
When I tested the module with the following code:
and run it by decoding any text file, say, decoding its own:
I got the following error:
./node_modules/he/he.js:232 return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7) { ^ TypeError: html.replace is not a function at Object.decode (./node_modules/he/he.js:232:15)
and if I changed html.replace to String(html).replace, it fixes the TypeError. Is it a valid bug/fix?