Sha256: 3ea0064c63cd62579227d349cf0b1cd1155918585f72ed953c5f8a1fc4b3721b
Contents?: true
Size: 599 Bytes
Versions: 28
Compression:
Stored size: 599 Bytes
Contents
// 'use strict'; const path = require('path'); const isDirectory = require('is-directory'); function getDirectory(filepath ) { return new Promise((resolve, reject) => { return isDirectory(filepath, (err, filepathIsDirectory) => { if (err) { return reject(err); } return resolve(filepathIsDirectory ? filepath : path.dirname(filepath)); }); }); } getDirectory.sync = function getDirectorySync(filepath ) { return isDirectory.sync(filepath) ? filepath : path.dirname(filepath); }; module.exports = getDirectory;
Version data entries
28 entries across 27 versions & 9 rubygems