Skip to content

Commit

Permalink
refactor: drop lodash for lib/hexo/post (#3791)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW authored Oct 27, 2019
1 parent 73e7163 commit c48f6a8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/hexo/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ const assert = require('assert');
const moment = require('moment');
const Promise = require('bluebird');
const { join, extname } = require('path');
const assignIn = require('lodash/assignIn');
const clone = require('lodash/clone');
const chalk = require('chalk');
const yaml = require('js-yaml');
const { slugize, escapeRegExp } = require('hexo-util');
Expand Down Expand Up @@ -121,7 +119,7 @@ Post.prototype._renderScaffold = function(data) {
let yfmSplit;

return this._getScaffold(data.layout).then(scaffold => {
const frontMatter = prepareFrontMatter(clone(data));
const frontMatter = prepareFrontMatter({...data});
yfmSplit = yfm.split(scaffold);

return tag.render(yfmSplit.data, frontMatter);
Expand Down Expand Up @@ -202,7 +200,7 @@ Post.prototype.publish = function(data, replace, callback) {
return fs.readFile(src);
}).then(content => {
// Create post
assignIn(data, yfm(content));
Object.assign(data, yfm(content));
data.content = data._content;
delete data._content;

Expand Down

0 comments on commit c48f6a8

Please sign in to comment.