Skip to content
This repository has been archived by the owner on Feb 14, 2021. It is now read-only.

lookup return value #1

Open
tregusti opened this issue Aug 7, 2018 · 1 comment
Open

lookup return value #1

tregusti opened this issue Aug 7, 2018 · 1 comment

Comments

@tregusti
Copy link

tregusti commented Aug 7, 2018

Hi,

I'm using 1.0.1 and when I'm using basicFilter like this:

const { basicFilter } = require("accept-language-negotiator")
const code = basicFilter('sv', ['sv-SE', 'en-UK'])[0]

code becomes sv-SE like I assumed. However when I'm trying to use lookup like this:

const { lookup } = require("accept-language-negotiator")
const code = lookup('sv', ['sv-SE', 'en-UK'], null)

I would assume that code would become sv-SE. But it is what I sent in instead, sv. I read section 3.4 in the lookup information in the RFC but can't really see that this is how it should be.

The first matching tag found, according to the user's priority, is considered the closest match and is the item returned.

Is this a bug in lookup?

@jayco
Copy link
Owner

jayco commented Sep 7, 2019

Hi, I'm really sorry for the extremely late reply, thanks for taking the time to raise this issue.
Yes, this appears to be a bug - will be updated if I get a chance to start working on v2 (I would be grateful for PR contributions).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants