Skip to content

Instantly share code, notes, and snippets.

@charlieanstey
Created February 16, 2015 13:26
Show Gist options
  • Save charlieanstey/9259633e8163dde29fa3 to your computer and use it in GitHub Desktop.
Save charlieanstey/9259633e8163dde29fa3 to your computer and use it in GitHub Desktop.
Trello :: Export JSON to console using Node.js
'use strict';
var readline = require('readline');
// ------------------
function TrelloJsonExport() {}
TrelloJsonExport.prototype.outputComments = function(json) {
json = JSON.parse(json);
var comments = json.actions.filter(isCommentCard);
comments.reverse();
console.log('\nCOMMENTS START\n')
for(var i = 0; i < comments.length; i++) {
console.log(comments[i].data.text + '\n');
}
process.exit();
}
// Filter for comment cards
function isCommentCard(element, index, array) {
return element.type == 'commentCard';
}
// ------------------
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
var trello = new TrelloJsonExport();
rl.question('Enter Trello JSON:', trello.outputComments);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment