Skip to content

Commit

Permalink
Added TextDecoder require to fix node version 10.x (#154)
Browse files Browse the repository at this point in the history
Fix: Compatibility to node v10

* Added TextDecoder require to fix node version 10.x
* Made TextDecoder compatible with webpack and browserify
  • Loading branch information
yashha committed Nov 28, 2020
1 parent 4afce88 commit fdb17bd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hyphenopoly.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
* in a browser environment (e.g. browserified)
*/
let loader = require("fs");
const TD = typeof TextDecoder === "undefined"
? require("util").TextDecoder
: TextDecoder;

const decode = (() => {
const utf16ledecoder = new TextDecoder("utf-16le");
const utf16ledecoder = new TD("utf-16le");
return (ui16) => {
return utf16ledecoder.decode(ui16);
};
Expand Down

0 comments on commit fdb17bd

Please sign in to comment.