Skip to content

Commit

Permalink
Converting categories to an array when reading the article
Browse files Browse the repository at this point in the history
  • Loading branch information
acmarques committed Oct 29, 2010
1 parent 80a1bab commit b5851b8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/wheat/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ var Data = module.exports = {
props.version = version;
}
props.author = author;

if(props.categories != undefined){
props.categories = props.categories.split(',').map(function(element){
return element.trim();
});
}
return props;
},
callback
Expand Down Expand Up @@ -293,10 +299,7 @@ var Data = module.exports = {
function processCategories(err, articles) {
if (err) { callback(err); return; }
var categories = articles.reduce(function (start, element) {
var articleCategories = element.categories.split(',').map(function(element){
return element.trim();
});
articleCategories.forEach(function(category){
element.categories.forEach(function(category){
if(start.indexOf(category) == -1){
start = start.concat(category);
}
Expand Down

0 comments on commit b5851b8

Please sign in to comment.