aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNik Nyby <nikolas@gnu.org>2016-05-04 20:07:39 -0400
committerNik Nyby <nikolas@gnu.org>2016-05-04 20:07:39 -0400
commit090d69a18ef4f075f5da9335f3c0aa02ff568d9d (patch)
tree07c085a6052abb2d0ad96469428849772ef246a8 /lib
parent563e4fd2d084af86b71023e625405911e5e6bc04 (diff)
downloadlibrejsxul-090d69a18ef4f075f5da9335f3c0aa02ff568d9d.tar.lz
librejsxul-090d69a18ef4f075f5da9335f3c0aa02ff568d9d.tar.xz
librejsxul-090d69a18ef4f075f5da9335f3c0aa02ff568d9d.zip
Remove experimental array comprehension syntax
Based on an example here: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsICryptoHash#Example
Diffstat (limited to 'lib')
-rw-r--r--lib/script_entries/crypto.js5
1 files changed, 4 insertions, 1 deletions
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) {