From cdc31a73f4f09d89f84087c4d0bebd56bd92b8e1 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 25 Apr 2019 15:08:33 +0200 Subject: [PATCH] TextEncoder() doesn't require any arguments --- wrapper/wrap-template.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wrapper/wrap-template.js b/wrapper/wrap-template.js index 65b24fe7..b3bb7fc5 100644 --- a/wrapper/wrap-template.js +++ b/wrapper/wrap-template.js @@ -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; @@ -614,4 +614,4 @@ _onload && root.sodium.ready.then(function () { _onload(root.sodium) }); -})(this); \ No newline at end of file +})(this);