Fix of recognition of ArrayBuffer parameters

If js-sha3 is loaded using 'webpack' loader then the top-most
fuction is not called with global object (`global` in node,
`window` in browsers) and thus `root.ArrayBuffer` is undefined.

This patch introduces usage of `ArrayBuffer` without `root`
prefix similary to how e.g. `Uint8Array` is already used.
This commit is contained in:
happylynx
2016-12-27 20:18:36 +01:00
parent ec2a9948f9
commit 9f8c2a3fb3
+1 -1
View File
@@ -106,7 +106,7 @@
Keccak.prototype.update = function (message) { Keccak.prototype.update = function (message) {
var notString = typeof message != 'string'; var notString = typeof message != 'string';
if (notString && message.constructor == root.ArrayBuffer) { if (notString && message instanceof ArrayBuffer) {
message = new Uint8Array(message); message = new Uint8Array(message);
} }
var length = message.length, blocks = this.blocks, byteCount = this.byteCount, var length = message.length, blocks = this.blocks, byteCount = this.byteCount,