Skip to content

Commit

Permalink
Merge branch 'main' into renovate/npm-undici-vulnerability
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuhang0 authored Feb 19, 2024
2 parents 2366c3c + 471d777 commit 37b3208
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions __tests__/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,11 @@ describe('format', () => {
const expected = "select 1 from user where state = '\\Za\\Z'"
expect(format(query, ['\x1aa\x1a'])).toEqual(expected)
})

test('formats bigint values', () => {
const query = 'select 1 from user where id=? and id2=?'
const expected = 'select 1 from user where id=1 and id2=9223372036854775807'
expect(format(query, [1n,9223372036854775807n])).toEqual(expected)
})
})
})
2 changes: 1 addition & 1 deletion src/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function sanitize(value: Value): string {
return 'null'
}

if (typeof value === 'number') {
if (['number', 'bigint'].includes(typeof value)) {
return String(value)
}

Expand Down

0 comments on commit 37b3208

Please sign in to comment.