MCPcopy Create free account
hub / github.com/vercel/vercel / readConfigIfExists

Function readConfigIfExists

packages/python-analysis/src/util/config.ts:95–105  ·  view source on GitHub ↗
(
  filename: string,
  schema: z.ZodType<T>,
  filetype: string | undefined = undefined
)

Source from the content-addressed store, hash-verified

93 * @returns Validated config object, or null if file doesn't exist
94 */
95export async function readConfigIfExists<T>(
96 filename: string,
97 schema: z.ZodType<T>,
98 filetype: string | undefined = undefined
99): Promise<T | null> {
100 const content = await readFileTextIfExists(filename);
101 if (content == null) {
102 return null;
103 }
104 return parseConfig(content, filename, schema, filetype);
105}

Callers 3

maybeLoadPyProjectTomlFunction · 0.90
maybeLoadPipfileFunction · 0.90
maybeLoadPipfileLockFunction · 0.90

Calls 2

readFileTextIfExistsFunction · 0.90
parseConfigFunction · 0.85

Tested by

no test coverage detected