Experiment: Primitive, JSDoc-assisted runtime type checking for Ramda
It reads JSDoc documentation from the project's Ramda source file and uses
@param annotations to determine valid argument types in
- Throws a
TypeErrorwhen passing values of incorrect type to Ramda functions
npm install ramda-tin a project that has
var R = ;var doubleAll = R;; // oops
Lens value types are documented as
Lens, despite being type of
- How to smoothly make
ramda-tpart of development process but drop for production use?
@param Objectas second argument, and dispatches to
filter, a method of a different name than the function itself.
- Relies on JSDoc
@paramannotations to be correct. Some may not be. The generated
ramda.jsonmay be edited to correct types.
R.map's second argument is type of
Array. Becomes an issue when
R.mapis used to dispatch. Dispatched arguments are difficult to parse from JSDoc annotations because they're part of the description. Workaround: Check if value is dispatchable, i.e. has a method by the name of the function.
running ramda test suite with
DEBUG environment variable to
DEBUG=ramda-t node index.js