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 e5205fb commit b774084
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 @@ -68,6 +67,13 @@ const getTypeByValue = function (value) {
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)) {
if (item.js === Boolean) {
Expand Down

0 comments on commit b774084

Please sign in to comment.