summaryrefslogtreecommitdiffstats
path: root/lib/utils/lang.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-04-05 20:04:24 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-04-05 20:04:24 -0700
commit58bee15f376e5e56477d4e083493d9b6213fbc63 (patch)
tree5442c344acc9e0d60e103b96f7cc2d34e6a46721 /lib/utils/lang.js
parent4987beec2ba6d148d1d1e5f356f977a4daab9732 (diff)
downloadgitbook-58bee15f376e5e56477d4e083493d9b6213fbc63.zip
gitbook-58bee15f376e5e56477d4e083493d9b6213fbc63.tar.gz
gitbook-58bee15f376e5e56477d4e083493d9b6213fbc63.tar.bz2
Add basic code language normalization
Diffstat (limited to 'lib/utils/lang.js')
-rw-r--r--lib/utils/lang.js16
1 files changed, 16 insertions, 0 deletions
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
+};