Skip to content

Commit 5a503ff

Browse files
authored
Merge pull request #3986 from curbengh/chain-assignment
style: chained assignment
2 parents 9322cb6 + 3808441 commit 5a503ff

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

lib/extend/console.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ Console.prototype.register = function(name, desc, options, fn) {
5353
}
5454

5555
const c = fn;
56-
this.store[name.toLowerCase()] = fn;
56+
57+
this.store[name.toLowerCase()] = c;
5758
c.options = options;
5859
c.desc = desc;
5960

lib/extend/filter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class Filter {
3131
type = typeAlias[type] || type;
3232
priority = priority == null ? 10 : priority;
3333

34-
this.store[type] = this.store[type] || [];
3534
const store = this.store[type] || [];
35+
this.store[type] = store;
3636

3737
fn.priority = priority;
3838
store.push(fn);

lib/hexo/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,12 +473,12 @@ class Hexo {
473473
inherits(Hexo, EventEmitter);
474474

475475
Hexo.lib_dir = libDir + sep;
476-
Hexo.prototype.lib_dir = libDir + sep;
476+
Hexo.prototype.lib_dir = Hexo.lib_dir;
477477

478478
Hexo.core_dir = dirname(libDir) + sep;
479-
Hexo.prototype.core_dir = dirname(libDir) + sep;
479+
Hexo.prototype.core_dir = Hexo.core_dir;
480480

481481
Hexo.version = version;
482-
Hexo.prototype.version = version;
482+
Hexo.prototype.version = Hexo.version;
483483

484484
module.exports = Hexo;

lib/hexo/locals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Locals {
1616
if (!getter) return;
1717

1818
cache = getter();
19-
this.cache[name] = getter();
19+
this.cache[name] = cache;
2020
}
2121

2222
return cache;

lib/hexo/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const format = path => {
3232
};
3333

3434
Router.format = format;
35-
Router.prototype.format = format;
35+
Router.prototype.format = Router.format;
3636

3737
Router.prototype.list = function() {
3838
const { routes } = this;

lib/theme/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Theme extends Box {
3636
};
3737

3838
const _View = viewFn;
39-
this.View = viewFn;
39+
this.View = _View;
4040

4141
inherits(_View, View);
4242

@@ -66,7 +66,7 @@ class Theme extends Box {
6666
const ext = extname(path);
6767
const name = path.substring(0, path.length - ext.length);
6868
this.views[name] = this.views[name] || {};
69-
const views = this.views[name] || {};
69+
const views = this.views[name];
7070

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

0 commit comments

Comments
 (0)