4 const path = require('path');
5 const isDirectory = require('is-directory');
7 module.exports = function getDirectory(
12 return isDirectory.sync(filepath) ? filepath : path.dirname(filepath);
15 return new Promise((resolve, reject) => {
16 return isDirectory(filepath, (err, filepathIsDirectory) => {
20 return resolve(filepathIsDirectory ? filepath : path.dirname(filepath));