src/assets/js/libs/solid.js
/**
* Parses a Link header from an XHR HTTP Request.
* @method parseLinkHeader
* @param link {String} Contents of the Link response header
* @return {Object}
*/
Parses a Link header from an XHR HTTP Request.
Parses a Link header from an XHR HTTP Request .
function parseLinkHeader (link) {
  if (!link) {
    return {}
  }
  var linkexp = /<[^>]*>\s*(\s*;\s*[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g
  var paramexp = /[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g
  var matches = link.match(linkexp)
  var rels = {}
  for (var i = 0; i < matches.length; i++) {
    var split = matches[i].split('>')
    var href = split[0].substring(1)
    var ps = split[1]
    var s = ps.match(paramexp)
    for (var j = 0; j < s.length; j++) {
      var p = s[j]
      var paramsplit = p.split('=')
      var rel = paramsplit[1].replace(/["']/g, '')
      if (!rels[rel]) {
        rels[rel] = []
      }
      rels[rel].push(href)
      if (rels[rel].length > 1) {
        rels[rel].sort()
      }
    }
  }
  return rels
}
function parseLinkHeader ( link ) { if ( ! link ) { return { } } var linkexp = / <[^>]*>\s*(\s*;\s*[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$) / g var paramexp = / [^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")) / g var matches = link . match ( linkexp ) var rels = { } for ( var i = 0 ; i < matches . length ; i ++ ) { var split = matches [ i ] . split ( '>' ) var href = split [ 0 ] . substring ( 1 ) var ps = split [ 1 ] var s = ps . match ( paramexp ) for ( var j = 0 ; j < s . length ; j ++ ) { var p = s [ j ] var paramsplit = p . split ( '=' ) var rel = paramsplit [ 1 ] . replace ( / ["'] / g , '' ) if ( ! rels [ rel ] ) { rels [ rel ] = [ ] } rels [ rel ] . push ( href ) if ( rels [ rel ] . length > 1 ) { rels [ rel ] . sort ( ) } } } return rels }
Parses a Link header from an XHR HTTP Request.
Parses a Link header from an XHR HTTP Request .
// var name = paramsplit[0]