refactor: Cleanup options object parameters (#4296)

This commit is contained in:
Nayeem Rahman 2020-03-10 16:08:58 +00:00 committed by GitHub
parent fbc4731256
commit 6443e4aed1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 110 additions and 164 deletions

View file

@ -154,11 +154,14 @@ class SingleByteDecoder implements Decoder {
private _index: number[];
private _fatal: boolean;
constructor(index: number[], options: DecoderOptions) {
if (options.ignoreBOM) {
constructor(
index: number[],
{ ignoreBOM = false, fatal = false }: DecoderOptions = {}
) {
if (ignoreBOM) {
throw new TypeError("Ignoring the BOM is available only with utf-8.");
}
this._fatal = options.fatal || false;
this._fatal = fatal;
this._index = index;
}
handler(stream: Stream, byte: number): number {