MCPcopy Create free account
hub / github.com/Snapchat/Valdi / loadConfig

Function loadConfig

npm_modules/cli/src/utils/fileUtils.ts:197–206  ·  view source on GitHub ↗
(configPath: string)

Source from the content-addressed store, hash-verified

195}
196
197export function loadConfig(configPath: string): CopyConfig {
198 const ext = path.extname(configPath).toLowerCase();
199 const rawConfig = fs.readFileSync(configPath, 'utf8');
200
201 if (ext === '.json') {
202 return JSON.parse(rawConfig) as CopyConfig;
203 } else {
204 throw new Error(`Unsupported config file format: ${ext}`);
205 }
206}
207
208function precompilePatterns(patterns?: string[]): RegExp[] {
209 return patterns?.map(pattern => new RegExp(pattern)) ?? [];

Callers

nothing calls this directly

Calls 2

readFileSyncMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected