How to use the jsonpointer.js.get function in jsonpointer

To help you get started, we’ve selected a few jsonpointer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lbovet / docson / src / index.js View on Github external
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;
        }
    }
github timbeadle / grunt-tv4 / lib / reporter.js View on Github external
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));
	}
github lbovet / docson / src / index.js View on Github external
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');
github timbeadle / grunt-tv4 / lib / reporter.js View on Github external
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));

jsonpointer

Simple JSON Addressing.

MIT
Latest version published 2 years ago

Package Health Score

74 / 100
Full package analysis

Similar packages