Skip to content

Commit

Permalink
fix: handle bigint types separately to int to avoid TypeError with Bi…
Browse files Browse the repository at this point in the history
…gInt param
  • Loading branch information
paulish authored and dhensby committed Jul 2, 2024
1 parent 17fb419 commit f8ba27a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const getTypeByValue = function (value) {
return TYPES.NVarChar

case 'number':
case 'bigint':
if (value % 1 === 0) {
if (value < -2147483648 || value > 2147483647) {
return TYPES.BigInt
Expand All @@ -67,6 +66,13 @@ const getTypeByValue = function (value) {
} else {
return TYPES.Float
}

case 'bigint':
if (value < -2147483648n || value > 2147483647n) {
return TYPES.BigInt
} else {
return TYPES.Int
}

case 'boolean':
for (const item of Array.from(map)) {
Expand Down

0 comments on commit f8ba27a

Please sign in to comment.