Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
let resultStr = yaml.stringify(result);
if (typeof result !== 'boolean') try {
if (!options.yaml) {
try {
resultStr = yaml.stringify(result); // should be representable safely in yaml
let resultStr2 = yaml.stringify(result); // FIXME dropped 'noRefs:true' here
should(resultStr).not.be.exactly('{}','Result should not be empty');
should(resultStr).equal(resultStr2,'Result should have no object identity ref_s');
}
catch (ex) {
if (options.verbose>1) {
fs.writeFileSync('./debug.yaml',resultStr,'utf8');
console.warn('Result dumped to debug.yaml fixed.yaml');
let fix = reref(result);
fs.writeFileSync('./fixed.yaml',yaml.stringify(fix),'utf8');
}
should.fail(false,true,'Result cannot be represented safely in YAML');
}
}
validator.validate(result, options)
.then(function(options){
finalise(null,options);
})
.catch(function(ex){
finalise(ex,options);
});
}
catch (ex) {
console.warn(common.colour.normal + options.file);
else {
process(result,src,update,options);
}
}
else {
console.warn(update.target,'cannot update immutable type',rtype+' (target parent node instead)');
}
}
catch (ex) {
console.warn(update.target,'cannot be parsed',ex.message);
}
}
recurse(src,{},function(obj,key,state){
if (obj[key] === null) delete obj[key];
});
return reref(src);
}