(s: string)
| 499 | |
| 500 | /** True if the string matches the expected pattern for a number */ |
| 501 | export function matchesNumber(s: string): boolean { |
| 502 | return ( |
| 503 | /^(nan|oo|\+oo|-oo|infinity|\+infinity|-infinity)$/i.test(s) || |
| 504 | // Optional fraction part where, after the decimal point, at least one of |
| 505 | // {fractional digits, repeating-decimal group} is present. This accepts the |
| 506 | // digit-less repetend form `0.(3)` (per the MathJSON spec's `1.(3)` example) |
| 507 | // while still rejecting a bare trailing `.` (e.g. `5.`). |
| 508 | /^[+-]?(0|[1-9][0-9]*)(\.([0-9]+(\([0-9]+\))?|\([0-9]+\)))?([eE][+-]?[0-9]+)?$/.test( |
| 509 | s |
| 510 | ) |
| 511 | ); |
| 512 | } |
| 513 | |
| 514 | /** True if the string matches the expected pattern for a symbol */ |
| 515 | export function matchesSymbol(s: string): boolean { |
no outgoing calls
no test coverage detected