(text: string, start = 0)
| 426 | }, |
| 427 | }; |
| 428 | function parseDirection(text: string, start = 0): Parsed<Angle> { |
| 429 | directionRegEx.lastIndex = start; |
| 430 | const result = directionRegEx.exec(text); |
| 431 | if (!result) { |
| 432 | return null; |
| 433 | } |
| 434 | const end = directionRegEx.lastIndex; |
| 435 | const firstDirection = result[1]; |
| 436 | if (result[2]) { |
| 437 | const secondDirection = result[2]; |
| 438 | const value = cornerDirections[firstDirection][secondDirection]; |
| 439 | |
| 440 | return value === undefined ? null : { start, end, value }; |
| 441 | } else { |
| 442 | return { start, end, value: sideDirections[firstDirection] }; |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | const openingBracketRegEx = /\s*\(\s*/gy; |
| 447 | const closingBracketRegEx = /\s*\)\s*/gy; |
no outgoing calls
no test coverage detected