all files / file-manager-js/lib/exists/ fn.js

85.71% Statements 6/7
50% Branches 1/2
100% Functions 0/0
80% Lines 4/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16              46× 25×   21× 21×        
/**
 * file-manager-js/exists
 * @copyright 2018 Eyas Ranjous <eyas.ranjous@gmail.com>
 * @license MIT
 */
 
// checks if a file or dir exists
module.exports = stat => path => stat(path)
  .then(() => true)
  .catch((error) => {
    Eif (error.code === 'ENOENT') {
      return false;
    }
    return Promise.reject(error);
  });