nl_tokens: Parse a media type from the Accept header .
pl_tokens: function parseMediaType ( str , i ) { var match = simpleMediaTypeRegExp . exec ( str ) ; if ( ! match ) return null ; var params = Object . create ( null ) ; var q = 1 ; var subtype = match [ 2 ] ; var type = match [ 1 ] ; if ( match [ 3 ] ) { var kvps = splitParameters ( match [ 3 ] ) . <mask> ( splitKeyValuePair ) ; for ( var j = 0 ; j < kvps . length ; j ++ ) { var pair = kvps [ j ] ; var key = pair [ 0 ] . toLowerCase ( ) ; var val = pair [ 1 ] ; // get the value, unwrapping quotes var value = val && val [ 0 ] === '"' && val [ val . length - 1 ] === '"' ? val . substr ( 1 , val . length - 2 ) : val ; if ( key === 'q' ) { q = parseFloat ( value ) ; break ; } // store parameter params [ key ] = value ; } } return { type : type , subtype : subtype , params : params , q : q , i : i } ; }