1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-01 01:27:31 -04:00
notes/node_modules/cosmiconfig/index.js

28 lines
692 B
JavaScript
Raw Normal View History

2017-03-09 13:16:08 -05:00
'use strict';
var path = require('path');
var oshomedir = require('os-homedir');
var minimist = require('minimist');
var assign = require('object-assign');
var createExplorer = require('./lib/createExplorer');
var parsedCliArgs = minimist(process.argv);
module.exports = function (moduleName, options) {
options = assign({
packageProp: moduleName,
rc: '.' + moduleName + 'rc',
js: moduleName + '.config.js',
argv: 'config',
rcStrictJson: false,
stopDir: oshomedir(),
cache: true,
}, options);
if (options.argv && parsedCliArgs[options.argv]) {
options.configPath = path.resolve(parsedCliArgs[options.argv]);
}
return createExplorer(options);
};