Initial commit
[yaffs-website] / node_modules / liftoff / lib / find_cwd.js
1 const path = require('path');
2
3 module.exports = function (opts) {
4   if (!opts) {
5     opts = {};
6   }
7   var cwd = opts.cwd;
8   var configPath = opts.configPath;
9   // if a path to the desired config was specified
10   // but no cwd was provided, use configPath dir
11   if (typeof configPath === 'string' && !cwd) {
12     cwd = path.dirname(path.resolve(configPath));
13   }
14   if (typeof cwd === 'string') {
15     return path.resolve(cwd);
16   }
17   return process.cwd();
18 };