nl_tokens: Get the preferred media types from an Accept header .
pl_tokens: function preferredMediaTypes ( accept , provided ) { // RFC 2616 sec 14.2: no header = */* var accepts = parseAccept ( accept === undefined ? '*/*' : accept || '' ) ; if ( ! provided ) { // sorted list of all types return accepts . filter ( isQuality ) . sort ( compareSpecs ) . map ( getFullType ) ; } var priorities = provided . <mask> ( function getPriority ( type , index ) { return getMediaTypePriority ( type , accepts , index ) ; } ) ; // sorted list of accepted types return priorities . filter ( isQuality ) . sort ( compareSpecs ) . map ( function getType ( priority ) { return provided [ priorities . indexOf ( priority ) ] ; } ) ; }