Tidied up consumeWhile and consumeUntil

This commit is contained in:
n1474335 2019-11-13 18:04:36 +00:00
parent ea6d80edfb
commit 03f4740968

View File

@ -156,7 +156,6 @@ export default class Stream {
// val is an array
/**
* Builds the skip forward table from the value to be searched.
*
@ -173,9 +172,7 @@ export default class Stream {
}
const length = val.length;
const initial = val[length-1];
this.position = length;
// Get the skip table.
@ -183,7 +180,6 @@ export default class Stream {
let found = true;
while (this.position < this.length) {
// Until we hit the final element of val in the stream.
while ((this.position < this.length) && (this.bytes[this.position++] !== initial));
@ -208,7 +204,7 @@ export default class Stream {
/**
* Consume bytes if it matches the supplied value.
* Consume bytes if they match the supplied value.
*
* @param {Number} val
*/
@ -219,6 +215,7 @@ export default class Stream {
}
this.position++;
}
this.bitPos = 0;
}
/**