1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-06 23:37:19 -05:00
notes/node_modules/cosmiconfig/index.js
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

28 lines
692 B
JavaScript

'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);
};