diff --git a/lib/theme/view.js b/lib/theme/view.js index 04e5cb6e8f..7689356b64 100644 --- a/lib/theme/view.js +++ b/lib/theme/view.js @@ -4,14 +4,6 @@ const { dirname, extname, join } = require('path'); const yfm = require('hexo-front-matter'); const Promise = require('bluebird'); -const assignIn = (target, ...sources) => { - let source = []; - sources.forEach(src => { - source.push(...[src, Object.getPrototypeOf(src)]); - }); - return Object.assign(target, ...source); -}; - function View(path, data) { this.path = path; this.source = join(this._theme.base, 'layout', path); @@ -70,7 +62,8 @@ View.prototype._buildLocals = function(locals) { const data = Object.assign({}, this.data); delete data.layout; delete data._concat; - return assignIn({}, locals, data, { + + return Object.assign({}, locals, Object.getPrototypeOf(locals), data, { filename: this.source }); };