(val: string)
| 201 | * - Decimal strings are preserved as-is |
| 202 | */ |
| 203 | export function normalizeFloatDefault(val: string): (ab: ExpressionBuilder) => AstFactory<Expression> { |
| 204 | if (/^-?\d+$/.test(val)) { |
| 205 | return (ab) => ab.NumberLiteral.setValue(val + '.0'); |
| 206 | } |
| 207 | if (/^-?\d+\.\d+$/.test(val)) { |
| 208 | return (ab) => ab.NumberLiteral.setValue(val); |
| 209 | } |
| 210 | return (ab) => ab.NumberLiteral.setValue(val); |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Normalize a default value string for a Decimal field. |
no test coverage detected