Skip to content

Commit

Permalink
refactor(post.createAssetFolder): async/await
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh committed Dec 15, 2019
1 parent a28a585 commit 380b469
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/hexo/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,13 @@ const removeExtname = str => {
return str.substring(0, str.length - extname(str).length);
};

const createAssetFolder = (path, assetFolder) => {
const createAssetFolder = async(path, assetFolder) => {
if (!assetFolder) return Promise.resolve();

const target = removeExtname(path);

return exists(target).then(exist => {
if (!exist) return mkdirs(target);
});
const exist = await exists(target);
if (!exist) return mkdirs(target);
};

class Post {
Expand Down

0 comments on commit 380b469

Please sign in to comment.