Skip to content

Commit

Permalink
Merge pull request #3986 from curbengh/chain-assignment
Browse files Browse the repository at this point in the history
style: chained assignment
  • Loading branch information
SukkaW authored Dec 18, 2019
2 parents 9322cb6 + 3808441 commit 5a503ff
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion lib/extend/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ Console.prototype.register = function(name, desc, options, fn) {
}

const c = fn;
this.store[name.toLowerCase()] = fn;

this.store[name.toLowerCase()] = c;
c.options = options;
c.desc = desc;

Expand Down
2 changes: 1 addition & 1 deletion lib/extend/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class Filter {
type = typeAlias[type] || type;
priority = priority == null ? 10 : priority;

this.store[type] = this.store[type] || [];
const store = this.store[type] || [];
this.store[type] = store;

fn.priority = priority;
store.push(fn);
Expand Down
6 changes: 3 additions & 3 deletions lib/hexo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,12 @@ class Hexo {
inherits(Hexo, EventEmitter);

Hexo.lib_dir = libDir + sep;
Hexo.prototype.lib_dir = libDir + sep;
Hexo.prototype.lib_dir = Hexo.lib_dir;

Hexo.core_dir = dirname(libDir) + sep;
Hexo.prototype.core_dir = dirname(libDir) + sep;
Hexo.prototype.core_dir = Hexo.core_dir;

Hexo.version = version;
Hexo.prototype.version = version;
Hexo.prototype.version = Hexo.version;

module.exports = Hexo;
2 changes: 1 addition & 1 deletion lib/hexo/locals.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Locals {
if (!getter) return;

cache = getter();
this.cache[name] = getter();
this.cache[name] = cache;
}

return cache;
Expand Down
2 changes: 1 addition & 1 deletion lib/hexo/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const format = path => {
};

Router.format = format;
Router.prototype.format = format;
Router.prototype.format = Router.format;

Router.prototype.list = function() {
const { routes } = this;
Expand Down
4 changes: 2 additions & 2 deletions lib/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Theme extends Box {
};

const _View = viewFn;
this.View = viewFn;
this.View = _View;

inherits(_View, View);

Expand Down Expand Up @@ -66,7 +66,7 @@ class Theme extends Box {
const ext = extname(path);
const name = path.substring(0, path.length - ext.length);
this.views[name] = this.views[name] || {};
const views = this.views[name] || {};
const views = this.views[name];

views[ext] = new this.View(path, data);
}
Expand Down

0 comments on commit 5a503ff

Please sign in to comment.