MCPcopy Index your code
hub / github.com/node-modules/utility / getParamNames

Function getParamNames

src/function.ts:18–30  ·  view source on GitHub ↗
(func: (...args: any[]) => any, cache?: boolean)

Source from the content-addressed store, hash-verified

16 * @return {Array} names
17 */
18export function getParamNames(func: (...args: any[]) => any, cache?: boolean): string[] {
19 const type = typeof func;
20 assert.equal(type, 'function', `The "func" must be a function. Received type "${type}"`);
21
22 cache = cache !== false;
23 if (cache && '__cache_names' in func) {
24 return func.__cache_names as string[];
25 }
26 const str = func.toString();
27 const names = str.slice(str.indexOf('(') + 1, str.indexOf(')')).match(/([^\s,]+)/g) || [];
28 Reflect.set(func, '__cache_names', names);
29 return names;
30}

Callers 1

function.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…