lib/utils.js
function getRefPathValue (schema, refPath) {
  let rpath = refPath
  const hashIndex = refPath.indexOf('#')
  if (hashIndex >= 0) {
    rpath = refPath.substring(hashIndex)
    if (rpath.length > 1) {
      rpath = refPath.substring(1)
    } else {
      rpath = ''
    }
  }

  // Walk through each /-separated path component, and get
  // the value for that key (ignoring empty keys)
  const keys = rpath.split('/').filter(k => !!k)
  return keys.reduce(function (value, key) {
    return value[key]
  }, schema)
}
function getRefPathValue (schema, refPath) {
  let rpath = refPath
  const hashIndex = refPath.indexOf('#')
  if (hashIndex >= 0) {
    rpath = refPath.substring(hashIndex)
    if (rpath.length > 1) {
      rpath = refPath.substring(1)
    } else {
      rpath = ''
    }
  }

  // Walk through each /-separated path component, and get
  // the value for that key (ignoring empty keys)
  const keys = rpath.split('/').filter(k => !!k)
  return keys.reduce(function (value, key) {
    return value[key]
  }, schema)
}
function getRefPathValue ( schema , refPath ) { let rpath = refPath const hashIndex = refPath . indexOf ( '#' ) if ( hashIndex >= 0 ) { rpath = refPath . substring ( hashIndex ) if ( rpath . length > 1 ) { rpath = refPath . substring ( 1 ) } else { rpath = '' } } // Walk through each /-separated path component, and get // the value for that key (ignoring empty keys) const keys = rpath . split ( '/' ) . filter ( k => ! ! k ) return keys . reduce ( function ( value , key ) { return value [ key ] } , schema ) }
Gets the value at the ref path within schema
@param schema the (root) json schema to search
@param refPath string ref path to get within the schema. Ex. `#/definitions/id`
@returns {*} Returns the value at the path location or undefined if not found within the given schema
@private
Gets the value at the ref path within schema