Coerces a numeric input value to number, or `undefined` when unset or invalid.
(value: unknown)
| 42 | |
| 43 | /** Coerces a numeric input value to number, or `undefined` when unset or invalid. */ |
| 44 | function optionalNumber(value: unknown): number | undefined { |
| 45 | const str = optionalString(value) |
| 46 | if (str === undefined) return undefined |
| 47 | const num = Number(str) |
| 48 | return Number.isNaN(num) ? undefined : num |
| 49 | } |
| 50 | |
| 51 | /** Wraps a worksheet name in single quotes when it contains characters that require escaping in an address. */ |
| 52 | function quoteSheetName(sheetName: string): string { |
no test coverage detected