federomero/negotiator — pull request #5 by shockie (2012-08-20 13:33:12+00:00)
Title: singular preferred methods returns a fallback when no matches found

Hi,

I came into a situation where I needed a default language if no match was found. It wasn't supported so I implemented it.

suppose a incoming request with the accept-language set to 'en-US, en;q=0.8'

```
var negotiator = new Negotiator(request);
var language = negotiator.getPreferredLanguage(['es', 'de']);
```

the language variable returned undefined. If you add a second parameter, the fallback:

```
var negotiator = new Negotiator(request);
var language = negotiator.getPreferredLanguage(['es', 'de'], 'es');
```

the language variable is equal to es