added move command (#585)

Co-authored-by: Max Isom <codetheweb@users.noreply.github.com>
This commit is contained in:
Rithwik Rayani 2022-03-19 20:33:08 +05:30 committed by GitHub
parent 60376d4f57
commit 46df0875d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 0 deletions

View file

@ -554,4 +554,14 @@ export default class {
resolve(returnedStream);
});
}
move(from: number, to: number): void {
if (from > this.queueSize() || to > this.queueSize()){
throw new Error('Move index is outside the range of the queue.' )
}
this.queue.splice( this.queuePosition + to ,0, this.queue.splice(this.queuePosition + from, 1)[0]);
}
}