getParamNames

源码

https://github.com/ddzy/ts-utility-plugins/tree/master/src/ddzy/utility/function/getParamNames

说明

获取函数的形参名称数组

用法

index.ts
const result1 = utilityFunction.getParamNames(
function (...args: any[]) { },
);
const result2 = utilityFunction.getParamNames(
function func(name: string, age: number) { },
);
const result3 = utilityFunction.getParamNames(
function func(name: string, age: number, address: string, ...args: any) { },
);
console.log(result1); // []
console.log(result2); // ['name', 'age']
console.log(result3); // ['name', 'age', 'address']