MCPcopy Index your code
hub / github.com/nodejs/node / getPropFromRaw

Function getPropFromRaw

test/fixtures/snapshot/typescript.js:41587–41602  ·  view source on GitHub ↗
(prop, validateElement, elementTypeName)

Source from the content-addressed store, hash-verified

41585 return getPropFromRaw(prop, ts.isString, "string");
41586 }
41587 function getPropFromRaw(prop, validateElement, elementTypeName) {
41588 if (ts.hasProperty(raw, prop) && !isNullOrUndefined(raw[prop])) {
41589 if (ts.isArray(raw[prop])) {
41590 var result = raw[prop];
41591 if (!sourceFile && !ts.every(result, validateElement)) {
41592 errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, prop, elementTypeName));
41593 }
41594 return result;
41595 }
41596 else {
41597 createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, prop, "Array");
41598 return "not-array";
41599 }
41600 }
41601 return "no-prop";
41602 }
41603 function createCompilerDiagnosticOnlyIfJson(message, arg0, arg1) {
41604 if (!sourceFile) {
41605 errors.push(ts.createCompilerDiagnostic(message, arg0, arg1));

Callers 3

getConfigFileSpecsFunction · 0.85
getProjectReferencesFunction · 0.85
getSpecsFromRawFunction · 0.85

Calls 4

isNullOrUndefinedFunction · 0.85
everyMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected