mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-05 08:13:06 +08:00
10 lines
517 B
TypeScript
10 lines
517 B
TypeScript
// parseFloat over a string and Number.parseInt over a string with a radix
|
|
// lower statically; other argument types coerce, which only the embedded
|
|
// engine runs.
|
|
const text: string = process.argv.length > 99 ? "1.5" : "2.25";
|
|
const flag: boolean = process.argv.length > 99;
|
|
const count: number = process.argv.length;
|
|
console.log(parseFloat(text), Number.parseFloat(text), Number.parseInt("ff", 16));
|
|
console.log(parseFloat(flag as unknown as string));
|
|
console.log(Number.parseInt(count as unknown as string, 10));
|