formatLocation
formatLocation(
loc):string
Defined in: source-location.ts:371
Format a source location as a human-readable string.
Uses the global registry to find the appropriate formatter for the location’s kind. Falls back to just the file path if no formatter is registered.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string
Example
Section titled “Example”formatLocation({ kind: 'text', file: 'src/app.ts', line: 42 })// => 'src/app.ts:42'
formatLocation({ kind: 'json', file: 'config.json', path: ['users', 0, 'name'], line: 15 })// => 'config.json$.users[0].name (line 15)'
formatLocation({ kind: 'excel', file: 'data.xlsx', sheet: 'Sheet1', range: 'A1:B5' })// => 'data.xlsx[Sheet1!A1:B5]'