Skip to content

Commit

Permalink
refactor(hexo/index): use Set (#4013)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW authored Dec 30, 2019
1 parent 80777a8 commit f332669
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/hexo/index.js
Original file line number Diff line number Diff line change
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 f332669

Please sign in to comment.