Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit d838ee8

Browse files
authored
Merge pull request #23 from ZitRos/patch-1
Allow to use destructuring import with pick
2 parents ae4b643 + bad4f2c commit d838ee8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

index.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var isString = function(s){
44
return typeof(s) === 'string';
55
};
66

7-
module.exports.parse = function(al){
7+
function parse(al){
88
var strings = (al || "").match(regex);
99
return strings.map(function(m){
1010
if(!m){
@@ -26,15 +26,15 @@ module.exports.parse = function(al){
2626
}).sort(function(a, b){
2727
return b.quality - a.quality;
2828
});
29-
};
29+
}
3030

31-
module.exports.pick = function(supportedLanguages, acceptLanguage){
31+
function pick(supportedLanguages, acceptLanguage){
3232
if (!supportedLanguages || !supportedLanguages.length || !acceptLanguage) {
3333
return null;
3434
}
3535

3636
if(isString(acceptLanguage)){
37-
acceptLanguage = this.parse(acceptLanguage);
37+
acceptLanguage = parse(acceptLanguage);
3838
}
3939

4040
var supported = supportedLanguages.map(function(support){
@@ -66,4 +66,7 @@ module.exports.pick = function(supportedLanguages, acceptLanguage){
6666
}
6767

6868
return null;
69-
};
69+
}
70+
71+
module.exports.parse = parse;
72+
module.exports.pick = pick;

0 commit comments

Comments
 (0)