formatters/whisper: polish corner case handling code

This commit is contained in:
Péter Szilágyi 2015-04-17 11:20:40 +03:00
parent 6a058b690b
commit b326202314

View File

@ -159,11 +159,8 @@ var inputPostFormatter = function(post) {
post.priority = utils.fromDecimal(post.priority);
// fallback
if (post.topics == undefined) {
post.topics = []
}
if (!utils.isArray(post.topics)) {
post.topics = [post.topics];
post.topics = post.topics ? [post.topics] : [];
}
// format the following options
@ -195,8 +192,8 @@ var outputPostFormatter = function(post){
}
// format the following options
if (post.topics == undefined) {
post.topics = []
if (!post.topics) {
post.topics = [];
}
post.topics = post.topics.map(function(topic){
return utils.toAscii(topic);