paramsifier
v0.0.2
Published
Parameter parser, can handle functions and classes
Downloads
1
Readme
paramsifier
This library parses function and class constructor parameters.
How to use it ?
import { parseParameterList } from "paramsifier";
// With Classes
class MyClass {
constructor({ firstParam, secondParam }, thirdParam) {}
}
parseParameterList(MyClass.toString());
// [
// { name: 'firstParam', optional: false },
// { name: 'secondParam', optional: false },
// { name: 'thirdParam', optional: false }
// ]
// With Functions
function myFunction(param1, param2, param3) {}
parseParameterList(myFunction.toString());
// [
// { name: 'param1', optional: false },
// { name: 'param2', optional: false },
// { name: 'param3', optional: false }
// ]
Credits
Original parsed code has been extracted from awilix param-parser. Thanks @jeffijoe
Thanks @