Skip to content

Commit

Permalink
Merge pull request #23 from mfalkvidd/delight-nashorn-sandbox-compati…
Browse files Browse the repository at this point in the history
…bility

Add compatibility with delight-nashorn-sandbox
  • Loading branch information
generalmimon authored Dec 2, 2021
2 parents ebea02c + 8a79536 commit 1ae3924
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions KaitaiStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,16 +546,18 @@ KaitaiStream.prototype.ensureFixedContents = function(expected) {

KaitaiStream.bytesStripRight = function(data, padByte) {
var newLen = data.length;
while (data[newLen - 1] === padByte)
while (data[newLen - 1] === padByte) {
newLen--;
}
return data.slice(0, newLen);
};

KaitaiStream.bytesTerminate = function(data, term, include) {
var newLen = 0;
var maxLen = data.length;
while (newLen < maxLen && data[newLen] !== term)
while (newLen < maxLen && data[newLen] !== term) {
newLen++;
}
if (include && newLen < maxLen)
newLen++;
return data.slice(0, newLen);
Expand Down

0 comments on commit 1ae3924

Please sign in to comment.