MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / asDescription

Function asDescription

src/math-json/scripts/generate_OPERATORS.ts:93–104  ·  view source on GitHub ↗
(def: DefRecord)

Source from the content-addressed store, hash-verified

91 .trim()
92 .match(/^\((.*)\)\s*(?:[a-z_]+(?:\s+[a-z_]+)*\s*)?->/);
93 if (!match) return 'unknown';
94 const args = match[1].trim();
95 if (args === '') return '0';
96 // Split, and read the optional/variadic markers, at the TOP LEVEL only. A
97 // parameter type can carry commas and markers of its own —
98 // `reducer: (unknown, T) any -> unknown` is ONE parameter, and a naive
99 // `split(',')` counted `Fold` as 4-ary.
100 const params = topLevelParams(args);
101 if (params.some((p) => /[*+]$/.test(p))) return 'variadic';
102 if (params.some((p) => p.endsWith('?'))) return 'optional';
103 return String(params.length);
104}
105
106/** `args` split on the commas that separate PARAMETERS — those outside any
107 * `(`, `<` or `[` group. The `>` of an ARROW (`->`) closes nothing: without

Callers 1

buildPayloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected