Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async readFloat(e: IHeader) {
switch (e.len) {
case 0:
return 0.0;
case 4:
return this.tokenizer.readNumber(Token.Float32_BE);
case 8:
return this.tokenizer.readNumber(Token.Float64_BE);
case 10:
return this.tokenizer.readNumber(Token.Float64_BE);
default:
throw new Error(`Invalid IEEE-754 float length: ${e.len}`);
}
}
private async readFloat(e: IHeader) {
switch (e.len) {
case 0:
return 0.0;
case 4:
return this.tokenizer.readNumber(Token.Float32_BE);
case 8:
return this.tokenizer.readNumber(Token.Float64_BE);
case 10:
return this.tokenizer.readNumber(Token.Float64_BE);
default:
throw new Error(`Invalid IEEE-754 float length: ${e.len}`);
}
}