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

Function getHighestEndLocation

packages/utils/src/script.ts:425–439  ·  view source on GitHub ↗
(locations: SingleLocationData[])

Source from the content-addressed store, hash-verified

423}
424
425const getHighestEndLocation = (locations: SingleLocationData[]): SingleLocationData => {
426 return locations.reduce((highest, current) => {
427 if (current.location.end.line > highest.location.end.line) {
428 return current;
429 }
430
431 if (highest.location.end.line === current.location.end.line) {
432 if (current.location.end.column > highest.location.end.column) {
433 return current;
434 }
435 }
436
437 return highest;
438 }, locations[0]);
439};
440
441const getLowestStartLocation = (locations: SingleLocationData[]): SingleLocationData => {
442 return locations.reduce((lowest, current) => {

Callers 1

replaceOpsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected