MCPcopy Create free account
hub / github.com/davidkingzyb/SCAST / stringToNumber

Function stringToNumber

lib/acorn.js:5763–5770  ·  view source on GitHub ↗
(str, isLegacyOctalNumericLiteral)

Source from the content-addressed store, hash-verified

5761 };
5762
5763 function stringToNumber(str, isLegacyOctalNumericLiteral) {
5764 if (isLegacyOctalNumericLiteral) {
5765 return parseInt(str, 8)
5766 }
5767
5768 // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.
5769 return parseFloat(str.replace(/_/g, ""))
5770 }
5771
5772 function stringToBigInt(str) {
5773 if (typeof BigInt !== "function") {

Callers 1

acorn.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected