Use arrow functions for callbacks

This commit is contained in:
MICHAEL JACKSON
2017-11-08 10:14:46 -08:00
parent a8ab0b7dab
commit b614f8646d
14 changed files with 71 additions and 78 deletions

View File

@ -8,7 +8,7 @@ const IndexPage = require('../components/IndexPage')
const e = React.createElement
function getEntries(dir) {
return new Promise(function(resolve, reject) {
return new Promise((resolve, reject) => {
fs.readdir(dir, function(error, files) {
if (error) {
reject(error)
@ -16,8 +16,8 @@ function getEntries(dir) {
resolve(
Promise.all(
files.map(file => getFileStats(path.join(dir, file)))
).then(function(statsArray) {
return statsArray.map(function(stats, index) {
).then(statsArray => {
return statsArray.map((stats, index) => {
return { file: files[index], stats }
})
})