paramsifier
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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 @

Readme

Keywords

none

Package Sidebar

Install

npm i paramsifier

Weekly Downloads

0

Version

0.0.2

License

ISC

Unpacked Size

8.27 MB

Total Files

40

Last publish

Collaborators

  • sebaplaza