Get any arguments from any function.
This module will help you extract absolutely all valid arguments from functions and pass them to you as an array.
$ npm install fn-arg-names
const fnArgNames = require("fn-arg-names");
const result = fnArgNames("async function * a({a, b, c: d}, r = function(a,b) { return (a + b) }, {t = {}}, [e, f, [g, h], {i}, [j, {k}, [l, m, n]], ...args], o, /*p,*/ ...q){}");
console.log(result);
const simple = fnArgNames(function(a, b, c = (1 + 2 + 3), ...d) {});
console.log(simple);
[
[ 'a', 'b', 'c', origin: 'object' ],
'r',
[ 't', origin: 'object' ],
[
'e',
'f',
[ 'g', 'h', origin: 'array' ],
[ 'i', origin: 'object' ],
[ 'j', [Array], [Array], origin: 'array' ],
'...args',
origin: 'array'
],
'o',
'...q'
]
[ 'a', 'b', 'c', '...d' ]
Types: HERE!
The main function.
The same as fnArgNames.
The same as fnArgNames, but in case of syntax errors in string function will return a detailed analysis of the error.
If a string is passed, it returns the result of fnArgNames.strict, otherwise it returns the result of fnArgNames.default .
Yandex Mail - vladimirvsevolodovi@yandex.ru
Github - https://github.com/StormExecute/
Github - https://github.com/StormExecute/fn-arg-names/
NPM - https://www.npmjs.com/package/fn-arg-names/
MIT - https://mit-license.org/