Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(theme/view): drop lodash.assignIn #3969

Merged
merged 1 commit into from
Dec 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion lib/theme/view.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
'use strict';

const { dirname, extname, join } = require('path');
const assignIn = require('lodash/assignIn');
const yfm = require('hexo-front-matter');
const Promise = require('bluebird');

const assignIn = (...args) => {
const length = args.length;
const obj = args[0];

if (length < 2 || obj == null) return obj;
for (let index = 1; index < length; index++) {
const source = args[index];
const keys = [];
for (const key in source) keys.push(key);

const l = keys.length;
for (let i = 0; i < l; i++) {
const key = keys[i];
obj[key] = source[key];
}
}
return obj;
};

function View(path, data) {
this.path = path;
this.source = join(this._theme.base, 'layout', path);
Expand Down