MCPcopy Create free account
hub / github.com/SAP-samples/cloud-cap-samples-java / printProperty

Function printProperty

scripts/value.js:14–36  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

12const segments = path.split('.');
13
14function printProperty(file) {
15 let valuesYaml;
16 try {
17 valuesYaml = fs.readFileSync(file, 'utf-8');
18 } catch(error) {
19 return false;
20 }
21 const values = yaml.parse(valuesYaml);
22
23 let o = values;
24 for (let segment of segments) {
25 o = o[segment];
26 if (typeof o === "undefined" || o === null) return false;
27 }
28
29 if (typeof o === "object") {
30 console.log(JSON.stringify(o));
31 } else {
32 console.log(o);
33 }
34
35 return true;
36}
37
38printProperty('.values.yaml') || printProperty('values.yaml') || printProperty('chart/values.yaml') || process.exit(1);

Callers 1

value.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected