MCPcopy Create free account
hub / github.com/cursor/plugins / findOperatorIndex

Function findOperatorIndex

orchestrate/skills/orchestrate/scripts/measurements.ts:84–96  ·  view source on GitHub ↗
(line: string, op: MeasurementOp)

Source from the content-addressed store, hash-verified

82}
83
84export function findOperatorIndex(line: string, op: MeasurementOp): number {
85 // Match the operator only when surrounded by whitespace so that `<=` does
86 // not collide with `<` and a name like `lines<10` is not split.
87 let from = 0;
88 while (true) {
89 const idx = line.indexOf(op, from);
90 if (idx < 0) return -1;
91 const before = idx > 0 ? line[idx - 1] : " ";
92 const after = idx + op.length < line.length ? line[idx + op.length] : " ";
93 if (/\s/.test(before) && /\s/.test(after)) return idx;
94 from = idx + op.length;
95 }
96}
97
98export interface MeasurementCheck {
99 name: string;

Callers 1

parseMeasurementLineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected