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: drop lodash for lib/hexo/post #3791

Merged
merged 1 commit into from
Oct 27, 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
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