mirror of
https://github.com/gchq/CyberChef
synced 2025-12-14 23:33:25 +00:00
Adjustment to consumeWhile
This commit is contained in:
@@ -190,7 +190,7 @@ export default class Stream {
|
|||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
// Loop through the elements comparing them to val.
|
// Loop through the elements comparing them to val.
|
||||||
for (let x = length-1; x > -1; x--) {
|
for (let x = length-1; x >= 0; x--) {
|
||||||
if (this.bytes[this.position-length + x] !== val[x]) {
|
if (this.bytes[this.position-length + x] !== val[x]) {
|
||||||
found = false;
|
found = false;
|
||||||
|
|
||||||
@@ -213,7 +213,12 @@ export default class Stream {
|
|||||||
* @param {Number} val
|
* @param {Number} val
|
||||||
*/
|
*/
|
||||||
consumeWhile(val) {
|
consumeWhile(val) {
|
||||||
while ((++this.position < this.length) && (this.bytes[(this.position)] === val));
|
while (this.position < this.length){
|
||||||
|
if (this.bytes[this.position] !== val){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.position++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user