Every line of 'parseint radix' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
12 function toInt(str, radix) { 13 (0, _assertString.default)(str); 14 return parseInt(str, radix || 10); 15 }
44 export function parse_int(inputString: string, radix: number) { 45 const parsed = parseInt(inputString, radix) 46 if (inputString && radix && parsed) { 47 // the two arguments are provided, and parsed is not NaN 48 return parsed 49 } else { 50 throw new Error('parseInt expects two arguments a string s, and a positive integer i') 51 } 52 }
55 function isValidRadix(radix) { 56 return !( 57 (radix.type === "Literal" && typeof radix.value !== "number") || 58 (radix.type === "Identifier" && radix.name === "undefined") 59 ); 60 }
31 function parseInt(string, radix, guard) { 32 if (guard || radix == null) { 33 radix = 0; 34 } else if (radix) { 35 radix = +radix; 36 } 37 return nativeParseInt(toString(string), radix || 0); 38 }