Skip to content

Commit

Permalink
expriment: use lodash.assign instead of Object.assign
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Oct 27, 2019
1 parent 10d8fb7 commit 3d3d41b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/theme/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const { dirname, extname, join } = require('path');
const yfm = require('hexo-front-matter');
const Promise = require('bluebird');
const assign = require('lodash/assign');

function View(path, data) {
this.path = path;
Expand Down Expand Up @@ -61,7 +62,7 @@ View.prototype.renderSync = function(options = {}) {
View.prototype._buildLocals = function(locals) {
// eslint-disable-next-line no-unused-vars
const { layout, _content, ...data } = this.data;
return Object.assign({}, locals, Object.getPrototypeOf(locals), data, {
return assign({}, locals, Object.getPrototypeOf(locals), data, {
filename: this.source
});
};
Expand All @@ -70,8 +71,7 @@ View.prototype._bindHelpers = function(locals) {
const helpers = this._helper.list();
const keys = Object.keys(helpers);

for (let i = 0, len = keys.length; i < len; i++) {
const key = keys[i];
for (const key of keys) {
locals[key] = helpers[key].bind(locals);
}

Expand Down

0 comments on commit 3d3d41b

Please sign in to comment.