How to use cosmiconfig.loadJson:
GitHub: OlMue/jsdoc
89 90 91 92 93 94 95 96 97 98
this.filepath = filepath; } } function loadJson(filepath, content) { return cosmiconfig.loadJson(filepath, stripBom(stripJsonComments(content))); } function loadYaml(filepath, content) { return cosmiconfig.loadYaml(filepath, stripBom(content));
How to use cosmiconfig.loadYaml:
GitHub: doytsujin/gqless
29 30 31 32 33 34 35 36 37 38
'.yml': cosmiconfig.loadYaml, '.js': cosmiconfig.loadJs, '.ts': { async: TypeScriptLoader, }, noExt: cosmiconfig.loadYaml } export const getConfig = async (path?: string) => { const configPath = path && parse(resolve(path)).dir
How to use cosmiconfig.cosmiconfig:
107 108 109 110 111 112 113 114 115
### cosmiconfig() ```js const { cosmiconfig } = require('cosmiconfig'); const explorer = cosmiconfig(moduleName[, cosmiconfigOptions]) ``` Creates a cosmiconfig instance ("explorer") configured according to the arguments, and initializes its caches.
160
1
1
See more examples
How to use cosmiconfig.cosmiconfigSync:
GitHub: ihimanshubhutani/jsdoc
97 98 99 100 101 102 103 104 105 106
function loadYaml(filepath, content) { return defaultLoaders['.yaml'](filepath, stripBom(content)); } const explorerSync = cosmiconfigSync(MODULE_NAME, { cache: false, loaders: { '.json': loadJson, '.yaml': loadYaml,