lib/util.js
function toAbsolutePointer(relativePointer, basePointerParsed) {
  var base = basePointerParsed;
  var matches = relativePointer.match(RELATIVE_JSON_POINTER);
  if (!matches) return;
  var lvl = base.length;
  var up = +matches[1];
  var jsonPointer = matches[2];
  if (jsonPointer == '#') {
    if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);
    return base[lvl-up-1]; // resolved pointer value
  }

  if (up > lvl) throw new Error('Cannot reference script ' + up + ' levels up, current level is ' + lvl);
  var parsedPointer = pointer.parse(jsonPointer);
  if (up > 0) base = base.slice(0, -up);
  return base.concat(parsedPointer); // parsed absolute pointer as array
}
function toAbsolutePointer(relativePointer, basePointerParsed) {
  var base = basePointerParsed;
  var matches = relativePointer.match(RELATIVE_JSON_POINTER);
  if (!matches) return;
  var lvl = base.length;
  var up = +matches[1];
  var jsonPointer = matches[2];
  if (jsonPointer == '#') {
    if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);
    return base[lvl-up-1]; // resolved pointer value
  }

  if (up > lvl) throw new Error('Cannot reference script ' + up + ' levels up, current level is ' + lvl);
  var parsedPointer = pointer.parse(jsonPointer);
  if (up > 0) base = base.slice(0, -up);
  return base.concat(parsedPointer); // parsed absolute pointer as array
}
function toAbsolutePointer ( relativePointer , basePointerParsed ) { var base = basePointerParsed ; var matches = relativePointer . match ( RELATIVE_JSON_POINTER ) ; if ( ! matches ) return ; var lvl = base . length ; var up = + matches [ 1 ] ; var jsonPointer = matches [ 2 ] ; if ( jsonPointer == '#' ) { if ( up >= lvl ) throw new Error ( 'Cannot access property/index ' + up + ' levels up, current level is ' + lvl ) ; return base [ lvl - up - 1 ] ; // resolved pointer value } if ( up > lvl ) throw new Error ( 'Cannot reference script ' + up + ' levels up, current level is ' + lvl ) ; var parsedPointer = pointer . parse ( jsonPointer ) ; if ( up > 0 ) base = base . slice ( 0 , - up ) ; return base . concat ( parsedPointer ) ; // parsed absolute pointer as array }
converts relative JSON-pointer to an absolute JSON-pointer
@param  {String} relativePointer   relative JSON-pointer
@param  {Array<String>} basePointerParsed current base JSON-pointer parsed to segments and unescaped
@return {Array<String>} absolute JSON-pointer
converts relative JSON - pointer to an absolute JSON - pointer