From 090d69a18ef4f075f5da9335f3c0aa02ff568d9d Mon Sep 17 00:00:00 2001 From: Nik Nyby Date: Wed, 4 May 2016 20:07:39 -0400 Subject: Remove experimental array comprehension syntax Based on an example here: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsICryptoHash#Example --- lib/script_entries/crypto.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/script_entries/crypto.js') diff --git a/lib/script_entries/crypto.js b/lib/script_entries/crypto.js index d8d9c0a..9393e8b 100644 --- a/lib/script_entries/crypto.js +++ b/lib/script_entries/crypto.js @@ -37,11 +37,14 @@ CryptoString.prototype.init = function(hashAlgorithm, charset) { }; CryptoString.prototype.encryptString = function(str) { + var me = this; var result = {}; var data = this.converter.convertToByteArray(str, result); this.cryptoHash.update(data, data.length); var hash = this.cryptoHash.finish(false); - return [this.toHexString(hash.charCodeAt(i)) for (i in hash)].join(""); + return Array.from( + hash, + (c, i) => me.toHexString(hash.charCodeAt(i))).join(''); }; CryptoString.prototype.toHexString = function(charCode) { -- cgit v1.2.3