Skip to content

Commit

Permalink
TextEncoder() doesn't require any arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Apr 25, 2019
1 parent ffe6452 commit cdc31a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wrapper/wrap-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@
//
function from_string(str) {
if (typeof TextEncoder === "function") {
return new TextEncoder("utf-8").encode(str);
return new TextEncoder().encode(str);
}
str = unescape(encodeURIComponent(str));
var bytes = new Uint8Array(str.length);
for (var i = 0; i < str.length; i++) {
for (var i = 0, j = str.length; i < j; i++) {
bytes[i] = str.charCodeAt(i);
}
return bytes;
Expand Down Expand Up @@ -614,4 +614,4 @@
_onload && root.sodium.ready.then(function () {
_onload(root.sodium)
});
})(this);
})(this);

0 comments on commit cdc31a7

Please sign in to comment.