Skip to content

Commit 1c88c55

Browse files
committed
Make compatible with ES5
template literal syntax is only available in ES6. By changing how the error message is generated, KaitaiStream.js can run under ES5.
1 parent 2de2c43 commit 1c88c55

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

KaitaiStream.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ KaitaiStream.prototype.alignToByte = function() {
419419
KaitaiStream.prototype.readBitsIntBe = function(n) {
420420
// JS only supports bit operations on 32 bits
421421
if (n > 32) {
422-
throw new Error(`readBitsIntBe: the maximum supported bit length is 32 (tried to read ${n} bits)`);
422+
throw new Error("readBitsIntBe: the maximum supported bit length is 32 (tried to read " + n + " bits)");
423423
}
424424
var bitsNeeded = n - this.bitsLeft;
425425
if (bitsNeeded > 0) {
@@ -458,7 +458,7 @@ KaitaiStream.prototype.readBitsInt = KaitaiStream.prototype.readBitsIntBe;
458458
KaitaiStream.prototype.readBitsIntLe = function(n) {
459459
// JS only supports bit operations on 32 bits
460460
if (n > 32) {
461-
throw new Error(`readBitsIntLe: the maximum supported bit length is 32 (tried to read ${n} bits)`);
461+
throw new Error("readBitsIntLe: the maximum supported bit length is 32 (tried to read " + n + " bits)");
462462
}
463463
var bitsNeeded = n - this.bitsLeft;
464464
if (bitsNeeded > 0) {

0 commit comments

Comments
 (0)