( path: string )
| 11 | const TILESET = /^\/(?<NAME>[0-9a-zA-Z\/!\-_\.\*\'\(\)]+).json$/; |
| 12 | |
| 13 | export const tile_path = ( |
| 14 | path: string |
| 15 | ): { |
| 16 | ok: boolean; |
| 17 | name: string; |
| 18 | tile?: [number, number, number]; |
| 19 | ext: string; |
| 20 | } => { |
| 21 | const tile_match = path.match(TILE); |
| 22 | |
| 23 | if (tile_match) { |
| 24 | const g = tile_match.groups!; |
| 25 | return { ok: true, name: g.NAME, tile: [+g.Z, +g.X, +g.Y], ext: g.EXT }; |
| 26 | } |
| 27 | |
| 28 | const tileset_match = path.match(TILESET); |
| 29 | |
| 30 | if (tileset_match) { |
| 31 | const g = tileset_match.groups!; |
| 32 | return { ok: true, name: g.NAME, ext: "json" }; |
| 33 | } |
| 34 | |
| 35 | return { ok: false, name: "", tile: [0, 0, 0], ext: "" }; |
| 36 | }; |
no outgoing calls
no test coverage detected
searching dependent graphs…