Skip to content

Commit

Permalink
relax some specific cases of Number.fromString validation before cl…
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Dec 5, 2023
1 parent 27ce99b commit bedf292
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- `Uint8Array.fromHex`
- `Uint8Array.prototype.toBase64`
- `Uint8Array.prototype.toHex`
- Relaxed some specific cases of [`Number.fromString`](https://github.com/tc39/proposal-number-fromstring) validation before clarification of [proposal-number-fromstring/24](https://github.com/tc39/proposal-number-fromstring/issues/24)
- Fixed `@@toStringTag` property descriptors on DOM collections, [#1312](https://github.com/zloirock/core-js/issues/1312)
- Fixed the order of arguments validation in `Array` iteration methods, [#1313](https://github.com/zloirock/core-js/issues/1313)
- Some minor `atob` / `btoa` improvements
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/modules/esnext.number.from-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $({ target: 'Number', stat: true, forced: true }, {
var parts = split(string, '.');
var mathNum = $parseInt(parts[0], R);
if (parts.length > 1) mathNum += $parseInt(parts[1], R) / pow(R, parts[1].length);
if (numberToString(mathNum, R) !== string) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION);
if (R === 10 && numberToString(mathNum, R) !== string) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION);
return sign * mathNum;
}
});

0 comments on commit bedf292

Please sign in to comment.