0.0.7 • Published 8 years ago
codements v0.0.7
codements
Node.js/JavaScript library to align code & comments.
Installation
Basic: npm install codements
As Dependency: npm install codements --save
Require in Node: var codements = require('codements');
What is this even useful for?
It's useful for generation of human-readable code. I personally use it in this Dota 2 Autoexec Generator.
codements.SplitView
Creates this type of codement:
var lineOfCode = true; // boolean variable
function test () { // I know you don't actually like writing unit-tests
return 'nope'; // neither do I
} // I wonder if anybody does
// comment overflow
[a,b] = [b,a]; // swapping pointless variables in ES6
Example
var codements = require('codements');
var parser = new codements.SplitView();
parser.addLine('var lineOfCode = true;', 'boolean variable');
parser.addLine('function test () {\n return \'nope\';\n}', 'I know you don\'t actually like writing unit-tests\nneither do I\nI wonder if anybody does\ncomment overflow');
parser.addLine('[a,b] = [b,a];', 'swapping pointless variables in ES6');
console.log(parser.render());