summaryrefslogtreecommitdiffstats
path: root/lib/utils/lang.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-04-10 02:21:54 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-04-10 02:21:54 -0700
commit619ded93adc01a870b8ee29722ff5e426c6fb8d7 (patch)
treeeb6b9bcc8a6e19b5d25ed75f7fa1f0ad51a0b8d9 /lib/utils/lang.js
parent2e85380cd822e05072b00d5f2493c263ac194395 (diff)
downloadgitbook-619ded93adc01a870b8ee29722ff5e426c6fb8d7.zip
gitbook-619ded93adc01a870b8ee29722ff5e426c6fb8d7.tar.gz
gitbook-619ded93adc01a870b8ee29722ff5e426c6fb8d7.tar.bz2
Improve language normalization
Check for null before converting to lower case
Diffstat (limited to 'lib/utils/lang.js')
-rw-r--r--lib/utils/lang.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/utils/lang.js b/lib/utils/lang.js
index 7fd71e1..9eabbb5 100644
--- a/lib/utils/lang.js
+++ b/lib/utils/lang.js
@@ -5,6 +5,8 @@ var MAP = {
};
function normalize(lang) {
+ if(!lang) { return null; }
+
var lower = lang.toLowerCase();
return MAP[lower] || lower;
}