jayco / accept-language-negotiator

RFC4647 compliant accept-language negotiator for parsing HTTP Accept-Language header and returning matched lists or language lookup.
MIT License
7 stars 3 forks source link

lookup prefers 'exact match' even with lower quality #6

Open ankon opened 4 years ago

ankon commented 4 years ago

Based on reading the RFC's description of lookup I would expect this:

expect(lookup('fr-FR, en;q=0.9', ['fr', 'en'])).to.be.equal('fr');

In my tests however it returns 'en', because 'en' is found to be an exact (direct) match.