func-has-param
Check if function in file has parameter
Install
npm install --save func-has-param
Usage
ES2015 (ES6)
;; let coffeeFile jsFile tsFile; // contents of awesome-js-file.js/** * function test(param) */jsFile = fs; ;// => true ;// => false // contents of awesome-coffee-file.coffee/** * test = (param) -> */coffeeFile = fs; ;// => true ;// => false // contents of awesome-ts-file.ts/** * function test (param: string): string */tsFile = fs; ;// => true ;// => true ;// => false ;// => false
ES5
var fs = funcHasParam = coffeeFile jsFile tsFile; // contents of awesome-js-file.js/** * function test(param) */jsFile = fs; ;// => true ;// => false // contents of awesome-coffee-file.coffee/** * test = (param) -> */coffeeFile = fs; ;// => true ;// => false // contents of awesome-ts-file.ts/** * function test (param: string): string */tsFile = fs; ;// => true ;// => true ;// => false ;// => false
Options
language
A string with the language of the file being inspected. Default option is js
for JavaScript. Other possible options are coffee
for CoffeeScript and ts
for TypeScript.
regex
Custom regex to use. Must include a group.
type
Only used when using language option with ts
value. A string that's used to match the parameter type as well as the parameter name.
LICENSE
MIT