mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 23:36:16 -04:00
Adjustment to consumeWhile
This commit is contained in:
parent
3921b4f445
commit
e9b7a43b9a
1 changed files with 7 additions and 2 deletions
|
@ -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++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue