MCPcopy Index your code
hub / github.com/angular/angular-cli / readAndParseJson

Function readAndParseJson

packages/angular/cli/src/utilities/json-file.ts:196–204  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

194 * @returns The parsed JSON object.
195 */
196export function readAndParseJson<T extends JsonValue>(path: string): T {
197 const errors: ParseError[] = [];
198 const content = parse(readFileSync(path, 'utf-8'), errors, { allowTrailingComma: true }) as T;
199 if (errors.length) {
200 formatError(path, errors);
201 }
202
203 return content;
204}
205
206/**
207 * Formats a JSON parsing error and throws an exception.

Callers 1

validateWorkspaceFunction · 0.90

Calls 2

parseFunction · 0.85
formatErrorFunction · 0.85

Tested by

no test coverage detected