making some good progress
This commit is contained in:
parent
5f3d697866
commit
e901fc3f76
15 changed files with 546 additions and 165 deletions
21
src/util/parse.ts
Normal file
21
src/util/parse.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
// Helpers...
|
||||
export function parseDouble(text: string): number | undefined {
|
||||
if (text === '') {
|
||||
return;
|
||||
}
|
||||
const num = Number(text);
|
||||
if (Number.isNaN(num)) {
|
||||
return;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
export function parseInt(text: string): bigint | undefined {
|
||||
if (text === '') {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
return BigInt(text);
|
||||
}
|
||||
catch (e) { };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue