MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / parseParameters

Function parseParameters

packages/hydrooj/src/entry/cli.ts:21–28  ·  view source on GitHub ↗
(fn: Function)

Source from the content-addressed store, hash-verified

19const COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;
20const ARR = /=>.*$/gm;
21function parseParameters(fn: Function) {
22 const code = fn.toString()
23 .replace(COMMENTS, '')
24 .replace(ARR, '');
25 const result = code.slice(code.indexOf('(') + 1, code.indexOf(')'))
26 .match(/([^,]+)/g)?.map((i) => i.trim());
27 return result ?? [];
28}
29
30async function runScript(name: string, arg: any) {
31 const s = global.Hydro.script[name];

Callers 1

cliFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected