Skip to content

Commit

Permalink
Merge pull request #19847 from zettca/fix/bigint
Browse files Browse the repository at this point in the history
fix: detectValue & parseDataValue not crashing with BigInt
  • Loading branch information
Ovilia committed Apr 29, 2024
2 parents 697e798 + e23a407 commit bdc5d4f
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 bdc5d4f

Please sign in to comment.