From 7d3501a44dcce75bb42ac2a08005a650edfcdb3c Mon Sep 17 00:00:00 2001 From: kunalpanchal Date: Tue, 25 Jun 2019 12:06:46 +0530 Subject: [PATCH] fs variable declaration fix --- lib/resources/fs/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/resources/fs/index.js b/lib/resources/fs/index.js index 116ebea..e770ca6 100644 --- a/lib/resources/fs/index.js +++ b/lib/resources/fs/index.js @@ -6,17 +6,17 @@ const fs = require('fs') module.exports = { get(from, size) { const rootPath = __dirname.split('/lib/resources/fs')[0] - const contentPath = _.get(environment(), 'source.config.contentPath') - if(!contentPath) reject('Could not read content directory.') - if(contentPath[0] !== '/') contentPath = '/' + contentPath + let contentPath = _.get(environment(), 'source.config.contentPath') + if (!contentPath) reject('Could not read content directory.') + if (contentPath[0] !== '/') contentPath = '/' + contentPath return new Promise((resolve, reject) => { let blogs = [] fs.readdir(rootPath + contentPath, async (err, files) => { - if(err) reject('Could not read content directory.') - for(let i = 0; i < files.length; i++) { + if (err) reject('Could not read content directory.') + for (let i = 0; i < files.length; i++) { let f = files[i] blogs.push(await new Promise(res => fs.readFile(rootPath + contentPath + '/' + f, 'utf-8', (err, content) => { - if(err) reject('Could not read file.', err) + if (err) reject('Could not read file.', err) let blog = {} blog.title = f.split('.')[0] blog.content = f.split('.')[1] === 'md' ? markdown.toHTML(content) : content