Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Converting categories to an array when reading the article

  • Loading branch information...
commit b5851b8331692752a7eb197fd3ddb3d5e0db9a23 1 parent 80a1bab
@acmarques authored
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/wheat/data.js
View
11 lib/wheat/data.js
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.