MCPcopy Create free account
hub / github.com/CashScript/cashscript / buildInsertions

Function buildInsertions

packages/utils/src/bitauth-script.ts:95–107  ·  view source on GitHub ↗
(
  locationData: FullLocationData,
  sourceLines: string[],
  sourceTags?: string,
)

Source from the content-addressed store, hash-verified

93];
94
95function buildInsertions(
96 locationData: FullLocationData,
97 sourceLines: string[],
98 sourceTags?: string,
99): Insertion[] {
100 const tags = (sourceTags ? parseSourceTags(sourceTags) : []);
101
102 return tags.map((tag) => {
103 const { insertAfterLine, indent } = deriveAnchor(tag, tags, locationData, sourceLines);
104 const annotation = `${indent}${tagDescription(tag, locationData, sourceLines)}`;
105 return { insertAfterLine, annotation, startIndex: tag.startIndex, endIndex: tag.endIndex };
106 });
107}
108
109function deriveAnchor(
110 tag: SourceTagEntry,

Callers 1

formatBitAuthScriptFunction · 0.85

Calls 3

parseSourceTagsFunction · 0.85
deriveAnchorFunction · 0.85
tagDescriptionFunction · 0.85

Tested by

no test coverage detected