stack-frame-utils
Utilities for working with stack frames.
API
getLinesAround
Parameters
line number The line number to provide context around.
count number The number of lines you'd like for context.
lines (Array<string> | string) The source code.
Returns Array<ScriptLine>
getSourceMap
Returns an instance of SourceMap for a given fileUri and fileContents.
Parameters
fileUri string The URI of the source file.
fileContents string The contents of the source file.
Returns Promise<SourceMap>
SourceMap
A wrapped instance of a SourceMapConsumer.
This exposes methods which will be indifferent to changes made in source-map.
getOriginalPosition
Returns the original code position for a generated code position.
Parameters
line number The line of the generated code position.
column number The column of the generated code position.
Returns {source: string, line: number, column: number}
getGeneratedPosition
Returns the generated code position for an original position.
Parameters
source string The source file of the original code position.
line number The line of the original code position.
column number The column of the original code position.
Returns {line: number, column: number}
getSource
Returns the code for a given source file name.
Parameters
sourceName string The name of the source file.
Returns string