nl_tokens: borrowed from https : // tools . ietf . org / html / rfc3986#appendix - B intentionally using regex and not <a / > href parsing trick because React Native and other environments where DOM might not be available
pl_tokens: function parseUrl ( <mask> ) { if ( typeof url !== 'string' ) return { } ; var match = url . match ( / ^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$ / ) ; // coerce to undefined values to empty string so we don't get 'undefined' var query = match [ 6 ] || '' ; var fragment = match [ 8 ] || '' ; return { protocol : match [ 2 ] , host : match [ 4 ] , path : match [ 5 ] , relative : match [ 5 ] + query + fragment // everything minus origin } ; }