summaryrefslogtreecommitdiffstats
path: root/lib/utils
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2014-04-05 20:06:38 -0700
committerAaron O'Mullan <aaron.omullan@gmail.com>2014-04-05 20:06:38 -0700
commit4547ec73fda25f037bda2692dc9fc66a037cbde9 (patch)
tree85e7b33a023efc41d2a4b3acfe44ad168e2e204e /lib/utils
parent761cfb4a2c68cfcfa5557dd41ca912cb716df05b (diff)
parentcae62676653e9664fd876a37b6363aecd7cfaf5a (diff)
downloadgitbook-4547ec73fda25f037bda2692dc9fc66a037cbde9.zip
gitbook-4547ec73fda25f037bda2692dc9fc66a037cbde9.tar.gz
gitbook-4547ec73fda25f037bda2692dc9fc66a037cbde9.tar.bz2
Merge pull request #31 from GitbookIO/feature/lang
Feature/lang
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/index.js3
-rw-r--r--lib/utils/lang.js16
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/utils/index.js b/lib/utils/index.js
new file mode 100644
index 0000000..155e723
--- /dev/null
+++ b/lib/utils/index.js
@@ -0,0 +1,3 @@
+module.exports = {
+ lang: require('./lang'),
+};
diff --git a/lib/utils/lang.js b/lib/utils/lang.js
new file mode 100644
index 0000000..7fd71e1
--- /dev/null
+++ b/lib/utils/lang.js
@@ -0,0 +1,16 @@
+var MAP = {
+ 'py': 'python',
+ 'js': 'javascript',
+ 'rb': 'ruby',
+};
+
+function normalize(lang) {
+ var lower = lang.toLowerCase();
+ return MAP[lower] || lower;
+}
+
+// Exports
+module.exports = {
+ normalize: normalize,
+ MAP: MAP
+};