MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / sourceLocationFromNode

Function sourceLocationFromNode

packages/nativescript-inspector/src/index.ts:1515–1532  ·  view source on GitHub ↗
(node: JSONObject)

Source from the content-addressed store, hash-verified

1513}
1514
1515function sourceLocationFromNode(node: JSONObject): JSONObject | null {
1516 const location = objectValue(node.sourceLocation);
1517 if (location.file) {
1518 return location;
1519 }
1520 const file = stringValue(node.sourceFile);
1521 if (!file) {
1522 return null;
1523 }
1524 const locationFromFields: JSONObject = { file };
1525 if (typeof node.sourceLine === "number") {
1526 locationFromFields.line = node.sourceLine;
1527 }
1528 if (typeof node.sourceColumn === "number") {
1529 locationFromFields.column = node.sourceColumn;
1530 }
1531 return locationFromFields;
1532}
1533
1534function firstSourceLocationFromNodes(nodes: JSONObject[]): JSONObject | null {
1535 for (const node of nodes) {

Callers 2

nativeScriptTabItemsFunction · 0.85

Calls 2

objectValueFunction · 0.85
stringValueFunction · 0.85

Tested by

no test coverage detected