const dir = require('node-dir')
const Deferred = require('promised-io/promise').Deferred
const path = require('path')
const _ = require('lodash')

function files(dirPath, fileExtension) {
  if (_.isEmpty(fileExtension)) {
    throw new Error('fileExtension is mandatory!')
  }

  const deferred = new Deferred()

  dir.files(path.resolve(dirPath), (err, fileList) => {
    if (err) {
      deferred.reject(err)
      return
    }

    deferred.resolve(fileList.filter((file) => (
      !_.startsWith(file, '.') && _.endsWith(file, fileExtension)))
    )
  })

  return deferred.promise
}

module.exports = {
  files,
}

@@ -31,24 +31,23 @@
 )%0Aconst 
-Deferred
+Promise
  = requi
@@ -75,17 +75,8 @@
 se')
-.Deferred
 %0Acon
@@ -284,16 +284,24 @@
 d = new 
+Promise.
 Deferred
@@ -443,16 +443,23 @@
 resolve(
+%0A      
 fileList
@@ -479,16 +479,8 @@
 ) =%3E
- (%0A     
  !_.
@@ -536,17 +536,16 @@
 ension))
-)
 %0A    )%0A 

Modify import and code style.