0.0.18 • Published 10 years ago
ramda-t v0.0.18
ramda-t 
Experiment: Primitive, JSDoc-assisted runtime type checking for Ramda
It reads JSDoc documentation from the project's Ramda source file and uses
the functions' @param
annotations to determine valid argument types in
function application.
features
- Throws a
TypeError
when passing values of incorrect type to Ramda functions
usage
npm install ramda-t
in a project that hasramda
installed.- Require
ramda-t
instead oframda
.
example
var R = require('ramda-t');
var doubleAll = R.map(R.multiply(2));
doubleAll('foo'); // oops
issues
Lens value types are documented asLens
, despite being type ofFunction
- How to smoothly make
ramda-t
part of development process but drop for production use? R.reject
takes@param Object
as second argument, and dispatches tofilter
, a method of a different name than the function itself.
caveats
- Relies on JSDoc
@param
annotations to be correct. Some may not be. The generatedramda.json
may be edited to correct types. R.map
's second argument is type ofArray
. Becomes an issue whenR.map
is 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 ramda-t
./scripts/test-ramda.sh
./scripts/test-ramda.sh propEq.js
debug output
Set DEBUG
environment variable to ramda-t
.
DEBUG=ramda-t node index.js
0.0.18
10 years ago
0.0.17
10 years ago
0.0.16
10 years ago
0.0.15
10 years ago
0.0.14
10 years ago
0.0.13
10 years ago
0.0.12
10 years ago
0.0.11
10 years ago
0.0.10
10 years ago
0.0.9
10 years ago
0.0.8
10 years ago
0.0.7
10 years ago
0.0.6
10 years ago
0.0.5
10 years ago
0.0.4
10 years ago
0.0.3
10 years ago
0.0.2
10 years ago
0.0.1
10 years ago