sassdoc-theme-light
Advanced tools
Comparing version 0.3.1 to 0.3.2
44
index.js
@@ -24,4 +24,4 @@ 'use strict'; | ||
function applyDisplay(ctx) { | ||
function shouldBeDisplayed (item) { | ||
function applyDisplay (ctx) { | ||
var shouldBeDisplayed = function (item) { | ||
var displayItemAccess = ctx.view.display.access.indexOf(item.access[0]) !== -1; | ||
@@ -31,20 +31,40 @@ var isAlias = item.alias; | ||
// TODO: simplify second part of expression | ||
return displayItemAccess && !(isAlias && !displayAlias); | ||
} | ||
var count = 0; | ||
var removeDuplicates = function (array) { | ||
return array.filter(function (elem, pos, self) { | ||
return self.indexOf(elem) == pos; | ||
}); | ||
} | ||
var flatten = function (array) { | ||
var merged = []; | ||
return merged.concat.apply(merged, array); | ||
} | ||
var group, type, count = 0; | ||
// Adding a `display` key to each item | ||
for (var group in ctx.data) { | ||
for (var i = 0; i < ctx.data[group].length; i++) { | ||
ctx.data[group][i].display = shouldBeDisplayed(ctx.data[group][i]); | ||
ctx.data.groups = removeDuplicates(flatten(ctx.data.groups)); | ||
if (ctx.data[group][i].display === true) { | ||
count++; | ||
} | ||
// For each group | ||
ctx.data.groups.forEach(function (g) { | ||
group = ctx.data.byGroupAndType[g]; | ||
// For each type in group | ||
for (type in group) { | ||
// For each item in type | ||
group[type].forEach(function (item) { | ||
item.display = shouldBeDisplayed(item); | ||
if (item.display === true) { | ||
count++; | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
ctx.dataCount = count; | ||
ctx.data.count = count; | ||
} | ||
@@ -51,0 +71,0 @@ |
{ | ||
"name": "sassdoc-theme-light", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
67706
242