Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const pdrFile = await fs.readFile(pdrFilePath, 'utf8');
// Investigating CUMULUS-423
if (pdrFile.trim().length === 0) throw new Error(`PDR file had no contents: ${pdrFilePath}`);
// because MODAPS PDRs do not follow the standard ODL spec
// we have to make sure there are spaces before and after every
// question mark
let pdrString = pdrFile.replace(/((\w*)=(\w*))/g, '$2 = $3');
// temporary fix for PVL not recognizing quoted strings as symbols
pdrString = pdrString.replace(/"/g, '');
let parsed;
try {
parsed = pvl.pvlToJS(pdrString);
}
catch (e) {
throw new PDRParsingError(e.message);
}
return parsed;
}
exports.parsePdr = (pdr) => pvl.pvlToJS(pdr);
exports.parsePdr = (pdr) => pvl.pvlToJS(pdr);