Skip to content

Commit

Permalink
Fix code climate comments
Browse files Browse the repository at this point in the history
 - Fix style issues in trelp
 - Add error handling when an unknown list is provided as input
  • Loading branch information
shiva committed May 8, 2015
1 parent 87c254c commit 5591ba9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions node/trello-processor/cmds/export-cards.js
Expand Up @@ -11,13 +11,13 @@ function replacer(key, value) {
return value;
}

if (["desc", "name"].indexOf(key) <= -1) {
if (['desc', 'name'].indexOf(key) <= -1) {
return undefined;
}
return value;
}

function getListByName(lists, name) {
function getListByName1(lists, name) {
var ret;

lists.forEach(function(list) {
Expand All @@ -29,13 +29,13 @@ function getListByName(lists, name) {
}

function printListing(listing) {
console.log("%d. %s", listing.id, listing.address);
console.log('%d. %s', listing.id, listing.address);
console.log(listing.url);
console.log("");
console.log('');
}

function removeCR(s) {
return s.replace(/\n$/, '')
return s.replace(/\n$/, '');
}

module.exports = function(program) {
Expand All @@ -59,10 +59,14 @@ module.exports = function(program) {
data = JSON.parse(data);

// filter and print
var doingList = getListByName(data['lists'], listname);
var doingList = getListByName1(data.lists, listname);
if (!doingList) {
console.error('Cannot find list : ', listname);
process.exit(1);
}

var i = 1;
data['cards'].forEach(function(card) {
data.cards.forEach(function(card) {
// for active cards in list, create listing object, and print
if ((!card.closed) && (card.idList === doingList.id)) {
var listing = {};
Expand Down

0 comments on commit 5591ba9

Please sign in to comment.