Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
allevo committed Nov 15, 2023
1 parent e536d7d commit fdb8510
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface CreateSerOption {
bufferSize?: number
}
export function createSer ({ bufferSize }: CreateSerOption = {}): Ser {
const size = bufferSize || 2 ** 24
const size = bufferSize ?? 2 ** 24
if (size >= 2 ** 32) {
throw new Error('bufferSize option must be strictly less than 2 ** 32')
}
Expand Down
8 changes: 3 additions & 5 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,9 @@ await t.test('with option', async t => {
const ser = createSer({ bufferSize: 2 ** 32 - 4 })
assert.equal(ser.buffer.byteLength, 2 ** 32 - 4)
}
{
assert.throws(() => createSer({ bufferSize: 2 ** 32 }), err => {
return /bufferSize option must be strictly less than 2 \*\* 32/.test((err as Error).message)
})
}
assert.throws(() => createSer({ bufferSize: 2 ** 32 }), err => {
return (err as Error).message.includes('bufferSize option must be strictly less than 2 ** 32')
})
})
})

Expand Down

0 comments on commit fdb8510

Please sign in to comment.