mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-02 14:11:02 +01:00
Adjustment to consumeWhile
This commit is contained in:
parent
3921b4f445
commit
e9b7a43b9a
@ -190,7 +190,7 @@ export default class Stream {
|
||||
found = true;
|
||||
|
||||
// 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]) {
|
||||
found = false;
|
||||
|
||||
@ -213,7 +213,12 @@ export default class Stream {
|
||||
* @param {Number} 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++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user