MCPcopy Index your code
hub / github.com/angular/angular / originalPositionFor

Function originalPositionFor

packages/compiler/test/output/source_map_util.ts:18–29  ·  view source on GitHub ↗
(
  sourceMap: SourceMap,
  genPosition: {line: number; column: number},
)

Source from the content-addressed store, hash-verified

16}
17
18export async function originalPositionFor(
19 sourceMap: SourceMap,
20 genPosition: {line: number; column: number},
21): Promise<SourceLocation> {
22 // Note: The `SourceMap` type from the compiler is different to `RawSourceMap`
23 // from the `source-map` package, but the method we rely on works as expected.
24 const smc = await new SourceMapConsumer(sourceMap as any);
25 // Note: We don't return the original object as it also contains a `name` property
26 // which is always null and we don't want to include that in our assertions...
27 const {line, column, source} = smc.originalPositionFor(genPosition);
28 return {line, column, source};
29}
30
31export function extractSourceMap(source: string): SourceMap | null {
32 let idx = source.lastIndexOf('\n//#');

Callers 2

expectMapFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…