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
TypeErrorwhen passing values of incorrect type to Ramda functions
npm install ramda-tin a project that has
var R = ;var doubleAll = R;; // oops
Lens, despite being type of
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.
@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.
DEBUG environment variable to
DEBUG=ramda-t node index.js