Skip to content

Commit

Permalink
reformatted code, fixed lint issues and added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Jun 29, 2015
1 parent 83a7f09 commit 0e33f7a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,10 @@ exports.asCSV = function(sorted) {
};

exports.asMarkDown = function(sorted) {
var text = new Array();
Object.keys(sorted).forEach(function(key) {
var module = sorted[key];

var line = '[' + key + '](' + module.repository + ') - ' + module.licenses;
text.push(line);
});

return text.join('\n');
var text = [];
Object.keys(sorted).forEach(function(key) {
var module = sorted[key];
text.push('[' + key + '](' + module.repository + ') - ' + module.licenses);
});
return text.join('\n');
};
4 changes: 4 additions & 0 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ var tests = {
assert.equal('"module name","license","repository"', str.split('\n')[0]);
assert.equal('"abbrev@1.0.7","ISC","https://github.com/isaacs/abbrev-js"', str.split('\n')[1]);
},
'and convert to MarkDown': function(d) {
var str = checker.asMarkDown(d);
assert.equal('[abbrev@1.0.7](https://github.com/isaacs/abbrev-js) - ISC', str.split('\n')[0]);
},
'should parse local without unknown': {
topic: function () {
var self = this;
Expand Down

0 comments on commit 0e33f7a

Please sign in to comment.