graph-environment.js
/**
 Given an IRI return the last element of its path.
 @param {(string|URL)} url
 @returns {string}
 */
Given an IRI return the last element of its path.
Given an IRI return the last element of its path .
function predicateLeaf(url) {
  var asURL = (url instanceof URL) ? url :
              (typeof url === 'string' || url instanceof String) ? new URL(url) :
              (url.type == "iri" || url.type == "uri" || url.type == "url") ? new URL(url.value) :
              (url.lexicalForm) ? new URL(url.lexicalForm) : undefined;
  return ( (asURL.hash.length > 0) ? asURL.hash.slice(1) : asURL.pathname.split('/').pop() );
}
function predicateLeaf ( url ) { var asURL = ( url instanceof URL ) ? url : ( typeof url === 'string' || url instanceof String ) ? new URL ( url ) : ( url . type == "iri" || url . type == "uri" || url . type == "url" ) ? new URL ( url . value ) : ( url . lexicalForm ) ? new URL ( url . lexicalForm ) : undefined ; return ( ( asURL . hash . length > 0 ) ? asURL . hash . slice ( 1 ) : asURL . pathname . split ( '/' ) . pop ( ) ) ; }
Given an IRI return the last element of its path.
Given an IRI return the last element of its path .