MCPcopy
hub / github.com/di-sukharev/opencommit / w3

Function w3

out/cli.cjs:65185–65202  ·  view source on GitHub ↗
(t2)

Source from the content-addressed store, hash-verified

65183 if (typeof r3 == "function") return r3.call(this, e3.data);
65184 }
65185 throw new Error(`Invalid node type: ${JSON.stringify(e3)}`);
65186 }
65187};
65188var y2 = /^[\w.-]+$/;
65189var { stringify: d3 } = JSON;
65190var V3 = /[|\\{}()[\]^$+*?.]/;
65191function w3(t2) {
65192 const e3 = [];
65193 let r3, n2;
65194 for (const a4 of t2) {
65195 if (n2) throw new Error(`Invalid parameter: Spread parameter ${d3(n2)} must be last`);
65196 const i3 = a4[0], s2 = a4[a4.length - 1];
65197 let o3;
65198 if (i3 === "<" && s2 === ">" && (o3 = true, r3)) throw new Error(`Invalid parameter: Required parameter ${d3(a4)} cannot come after optional parameter ${d3(r3)}`);
65199 if (i3 === "[" && s2 === "]" && (o3 = false, r3 = a4), o3 === void 0) throw new Error(`Invalid parameter: ${d3(a4)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);
65200 let l3 = a4.slice(1, -1);
65201 const f4 = l3.slice(-3) === "...";
65202 f4 && (n2 = a4, l3 = l3.slice(0, -3));
65203 const p4 = l3.match(V3);
65204 if (p4) throw new Error(`Invalid parameter: ${d3(a4)}. Invalid character found ${d3(p4[0])}`);
65205 e3.push({ name: l3, required: o3, spread: f4 });

Callers 1

x2Function · 0.85

Calls 3

sliceMethod · 0.45
matchMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected