Skip to content

Commit

Permalink
docs: add JSDoc comments to resolveConfig and loadConfig functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dankerow committed May 28, 2024
1 parent c1d3461 commit d7e88de
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/utils/configLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export type ResolvedConfig = { [P in keyof Config]-?: Config[P] } & {
[RESOLVED_CONFIG_SYMBOL]: true
}

/**
* Resolves a config, marking it with a special symbol.
* @param {Config | ResolvedConfig} config - The config to resolve.
* @returns {ResolvedConfig} The resolved config.
*/
export function resolveConfig(
config?: Config | ResolvedConfig
): ResolvedConfig {
Expand All @@ -27,8 +32,14 @@ export function resolveConfig(
return _config
}

/**
* Loads a config from a directory, with optional overrides.
* @param {string} dir - The directory to load the config from. Defaults to the current directory.
* @param {Config} overrides - Config values to override.
* @returns {Promise<ResolvedConfig>} The loaded and resolved config.
*/
export async function loadConfig(
dir = '.',
dir: string = '.',
overrides: Config
): Promise<ResolvedConfig> {
const { loadConfig } = await import('c12')
Expand Down

0 comments on commit d7e88de

Please sign in to comment.