Enforces Ramda names for a clean and consistent code base. Features enhanced debbuging that gives you precise stack traces for point-free programming with Ramda.
$ npm install --save-dev ramda-loader
Add the loader to your
moduleexports =// ...module:loaders:test: /\.js$/exclude: /node_modules/loader: 'ramda-loader'query:debug: true // Will wrap Ramda functions in error handles with file name, line number and char locationstrict: true // Will disallow variables that have the same name as Ramda functionsimports: true // Will add import statements for every Ramda function found
ramda-loader uses Abstract Syntax Tree (AST) parsing and analysing to instrument your code and produce new code.
This way you gain confidence that you can use Ramda functions anywhere and your code will continue to work exactly the same as before.
In order promote point-free programming,
ramda-loader enforces that you don't redeclare the names used by Ramda.
This ensures you achieve a standardised codebase that anyone can understand just by looking at Ramda's documentation - less maintanance on your side and less documentation to write.
Given this file:
var add10 =var answer =// The answer to your Ramda import problems
it will automatically import all the Ramda functions found:
var R =var add = Raddvar pipe = Rpipevar ifElse = RifElsevar equals = Requalsvar always = Ralwaysvar subtract = Rsubtractvar __ = R__var add10 =var answer =// The answer to your Ramda import problems
and with the
debug=true this becomes:
var __ramdaDebugWrapper = fn;var add = Raddvar pipe = Rpipevar ifElse = RifElsevar equals = Requalsvar always = Ralwaysvar subtract = Rsubtractvar __ = R__var add10 = 10;var answer = add10 42 'The answer to your Ramda import problems' __ 10;moduleexports = answer;
Install the dependencies, via:
$ npm install
then you can run:
$ npm run build
which will build the loader in the
Running The Test Suite
Install the dependencies (see Build)
Then you can run the tests by running (which also builds the loader):
$ npm test
Feel free to open issues to propose stuff and participate. Pull requests are also welcome.