Skip to content

Commit

Permalink
fix: detectValue & parseDataValue not crashing with BigInt
Browse files Browse the repository at this point in the history
  • Loading branch information
zettca committed Apr 17, 2024
1 parent 697e798 commit e23a407
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/data/helper/dataValueHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function parseDataValue(
? NaN
// If string (like '-'), using '+' parse to NaN
// If object, also parse to NaN
: +value;
: Number(value);
};


Expand Down
4 changes: 2 additions & 2 deletions src/data/helper/sourceHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ function doGuessOrdinal(
function detectValue(val: OptionDataValue): BeOrdinalValue {
const beStr = isString(val);
// Consider usage convenience, '1', '2' will be treated as "number".
// `isFinit('')` get `true`.
if (val != null && isFinite(val as number) && val !== '') {
// `Number('')` (or any whitespace) is `0`.
if (val != null && Number.isFinite(Number(val)) && val !== '') {
return beStr ? BE_ORDINAL.Might : BE_ORDINAL.Not;
}
else if (beStr && val !== '-') {
Expand Down

0 comments on commit e23a407

Please sign in to comment.