https://github.com/sebaplaza/paramsifier
https://github.com/sebaplaza/paramsifier
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/sebaplaza/paramsifier
- Owner: sebaplaza
- License: mit
- Created: 2022-12-01T17:31:18.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-01T20:54:19.000Z (over 2 years ago)
- Last Synced: 2024-12-11T21:06:48.181Z (5 months ago)
- Language: TypeScript
- Size: 65.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# paramsifier
This library parses function and class constructor parameters.
## How to use it ?
```js
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 parser code has [been extracted](https://github.com/jeffijoe/awilix/issues/307) from [awilix](https://github.com/jeffijoe/awilix) param-parser.
Thanks @jeffijoe