liquidcarrot / carrot

🥕 Evolutionary Neural Networks in JavaScript
https://liquidcarrot.io/carrot/
MIT License
295 stars 34 forks source link

Add custom JSDoc "expects" tag #183

Open christianechevarria opened 4 years ago

christianechevarria commented 4 years ago

Is your feature request related to a problem? Please describe. Minimized code will have implicit assumptions baked into it. Ideally no assumptions would ever be made but this would create repeated work. So it's desirable to trust that arguments will conform to certain standards e.g. an array is sorted or a property is set

Describe the solution you'd like As a way to make assumptions built into code explicit we could add a custom JSDoc @assumption that would go above the function declaration and render in the docs for a end-user consuming the software

Edit: As a way to shorten the syntax and broaden the applicability of the tag we could use @expects for interface related assumptions

christianechevarria commented 4 years ago

The code for this is already present within the JSDoc template files as support was added for @alpha and @beta tags in https://github.com/liquidcarrot/carrot/commit/ef21b991c07667a94cd44499bffb01ec5221b3b6 and we could use the same method to resolve this issue