Skip to content

Commit

Permalink
refactor(hexo/index): use Set
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Dec 27, 2019
1 parent 4687816 commit 6336cd9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/hexo/index.js
Expand Up @@ -36,15 +36,13 @@ const stopWatcher = box => { if (box.isWatching()) box.unwatch(); };

const routeCache = new WeakMap();

const unique = array => array.filter((item, index, self) => self.indexOf(item) === index);

const castArray = obj => { return Array.isArray(obj) ? obj : [obj]; };

const createLoadThemeRoute = function(generatorResult, locals, ctx) {
const { log, theme } = ctx;
const { path, cache: useCache } = locals;

const layout = unique(castArray(generatorResult.layout));
const layout = [...new Set(castArray(generatorResult.layout))];
const layoutLength = layout.length;

// allways use cache in fragment_cache
Expand Down

0 comments on commit 6336cd9

Please sign in to comment.