(errors: ParsingDiagnostic[])
| 309 | return [ |
| 310 | 'Error', |
| 311 | [ |
| 312 | 'String', |
| 313 | ...(errors.map((x) => { |
| 314 | // If we have an array as the last element, it's the trace. Remove it. |
| 315 | if ( |
| 316 | Array.isArray(x.message) && |
| 317 | Array.isArray(x.message[x.message.length - 1]) |
| 318 | ) { |
| 319 | return x.message.slice(0, -1); |
| 320 | } |
| 321 | |
| 322 | return x.message; |
| 323 | }) as Expression[]), |
| 324 | ], |
| 325 | ]; |
| 326 | } |
| 327 | |
| 328 | export function validEpsil(s: string): Expression | null { |
| 329 | const [value, errors] = parseEpsil(s); |
| 330 | if (errors && errors.length > 0) return formatError(errors); |
| 331 | return strip(value); |
| 332 | } |
no test coverage detected