Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var resolvePointerRef = function(ref) {
var root = stack[1];
if(ref=="#") {
return root;
}
try {
return jsonpointer.get(stack[1], ref);
} catch(e) {
console.log(e);
return null;
}
}
function reportError(out, ctx, error, indent, prefix, parentPath) {
var value = jsonpointer.get(ctx.data, error.dataPath);
var schemaValue = jsonpointer.get(ctx.schema, error.schemaPath);
indent = (typeof indent !== 'undefined' ? String(indent) : ' ');
prefix = (typeof prefix !== 'undefined' ? prefix : '');
out.writeln(prefix + out.warning(error.message));
if (typeof schemaValue !== 'undefined') {
out.writeln(prefix + indent + schemaValue + out.accent(' -> ') + tweakPath(out, error.schemaPath));
}
else {
out.writeln(prefix + indent + tweakPath(out, error.schemaPath));
}
if (error.dataPath && typeof parentPath !== 'string' || parentPath !== error.dataPath) {
out.writeln(prefix + indent + out.error(' > ') + valueType(value) + out.error(' -> ') + valueStrim(value));
out.writeln(prefix + indent + out.error(' > ') + tweakPath(out, error.dataPath));
}
get_document( uri.clone().hash('').toString() ).then(function(schema){
refs[uri.toString()] = uri.hash() ? jsonpointer.get( schema, uri.hash() ) : schema;
}).then(function(){
debug('get_ref');
function reportError(out, ctx, error, indent, prefix, parentPath) {
var value = jsonpointer.get(ctx.data, error.dataPath);
var schemaValue = jsonpointer.get(ctx.schema, error.schemaPath);
indent = (typeof indent !== 'undefined' ? String(indent) : ' ');
prefix = (typeof prefix !== 'undefined' ? prefix : '');
out.writeln(prefix + out.warning(error.message));
if (typeof schemaValue !== 'undefined') {
out.writeln(prefix + indent + schemaValue + out.accent(' -> ') + tweakPath(out, error.schemaPath));
}
else {
out.writeln(prefix + indent + tweakPath(out, error.schemaPath));
}
if (error.dataPath && typeof parentPath !== 'string' || parentPath !== error.dataPath) {
out.writeln(prefix + indent + out.error(' > ') + valueType(value) + out.error(' -> ') + valueStrim(value));
out.writeln(prefix + indent + out.error(' > ') + tweakPath(out, error.dataPath));