Skip to content

Commit

Permalink
refactor(theme/view): drop lodash.assignIn (hexojs#3969)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW authored and Thomas Parisot committed Jan 17, 2020
1 parent 5d5aadd commit b05a41c
Showing 1 changed file with 19 additions and 1 deletion.
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

0 comments on commit b05a41c

Please sign in to comment.