(value: any)
| 29 | } |
| 30 | |
| 31 | export function toString(value: any): string { |
| 32 | if (value === undefined || value === null) { |
| 33 | return ""; |
| 34 | } |
| 35 | if (typeof value === "string") { |
| 36 | return value; |
| 37 | } |
| 38 | if (value instanceof Date) { |
| 39 | return value.toISOString(); |
| 40 | } |
| 41 | if (value instanceof RegExp) { |
| 42 | return value.toString(); |
| 43 | } |
| 44 | return JSON.stringify(value, (k, v) => { |
| 45 | switch (typeof v) { |
| 46 | case "bigint": |
| 47 | return v.toString(); |
| 48 | } |
| 49 | return v; |
| 50 | }); |
| 51 | } |
| 52 | |
| 53 | export function toNumber(value: any): number { |
| 54 | if (value === undefined || value === null || value === "" || isNaN(value)) { |
no test coverage detected