Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 1.18 KB

api.md

File metadata and controls

47 lines (32 loc) · 1.18 KB

API

Constructor(workspace: string, options: IOptions)

Create instance of ConfigProfiler class.

const ConfigProfiler = require('config-profiler');
const configProfiler = new ConfigProfiler('./path', {});

For more details about the options, see ICoreOptions and IChangeableOptions.

setWorkspace(workspace)

Set a new workspace directory path.

configProfiler.setWorkspace('./path/to/workspace');

setOptions(options: IOptions)

Set a new options.

configProfiler.setOptions({
  configFiles: ['config.json', 'config.js']
});

For more details about the options, see ICoreOptions and IChangeableOptions.

getConfig(filepath, [options: IChangeableOptions]) => Promise

Get config for the current file path.

configProfiler.getConfig('./path/to/workspace/index.txt').then((result) => {
  // console.log(result);
  // { from: './path/to/workspace/config.json', config: { ok: true } }
});

Warning

Here available not all options. See only IChangeableOptions options.