awolden / brakes

Hystrix compliant Node.js Circuit Breaker Library
MIT License
300 stars 35 forks source link

Single-arg fat arrow function breaks brakes #83

Closed rocksoftcode closed 7 years ago

rocksoftcode commented 7 years ago

Sending a fat arrow function without parens (one arg only) into brakes causes an exception: TypeError: Cannot read property '1' of null

It appears to be breaking on the regex in getFnArgs in lib/utils.js:

/^[function\s]?.*?\(([^)]*)\)/
rocksoftcode commented 7 years ago

Here's a PR for a potential fix: https://github.com/awolden/brakes/pull/84

awolden commented 7 years ago

Thanks for the contribution @rockympls!