Add IndexOf property to WSRequest and Description classes; implement getValue function in recipes-and-patterns.js

This commit is contained in:
2025-10-13 17:10:26 -07:00
parent 0dc57eb3d7
commit 0a477c7ea1
7 changed files with 170 additions and 9 deletions

View File

@ -0,0 +1,36 @@
// getValue(getContextData('2', 'cds.NULL_DATA', ''));
function getValue(json) {
let result;
if (json == undefined || json.length === 0)
result = 'A) Invalid input!';
else {
let parsed;
try {
parsed = JSON.parse(json);
} catch (error) {
parsed = null;
}
if (parsed == null)
result = 'B) Invalid input!';
else {
let reactorType = parsed.rds == undefined ? '' : parsed.rds.reactorType == undefined ? '' : parsed.rds.reactorType;
if (parsed.rds == undefined)
result = '-';
else if (parsed.rds.loadLockSide == undefined)
result = '_ - ' + reactorType;
else if (parsed.rds.loadLockSide === 'L')
result = 'Left - ' + reactorType;
else if (parsed.rds.loadLockSide === 'R')
result = 'Right - ' + reactorType;
else
result = parsed.rds.loadLockSide + ' - ' + reactorType;
}
}
return result;
}
const json = '{"rds":{"prodSpec":{"recipesAndPatterns":[{"recipe":"6IN25_ROTR","pattern":"","patternSize":0,"tool":"TENCOR"}]}}}';
const testA = getValue(json);
if (testA !== '1')
throw 'Test A failed: ' + testA;