Permalink
Browse files

Converting categories to an array when reading the article

  • Loading branch information...
1 parent 80a1bab commit b5851b8331692752a7eb197fd3ddb3d5e0db9a23 @acmarques committed Oct 29, 2010
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/wheat/data.js
View
@@ -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
@@ -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);
}

0 comments on commit b5851b8

Please sign in to comment.