aboutsummaryrefslogtreecommitdiff
path: root/node_modules/lcid/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/lcid/index.js')
-rw-r--r--node_modules/lcid/index.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/node_modules/lcid/index.js b/node_modules/lcid/index.js
new file mode 100644
index 0000000..69bd3d2
--- /dev/null
+++ b/node_modules/lcid/index.js
@@ -0,0 +1,22 @@
+'use strict';
+var invertKv = require('invert-kv');
+var all = require('./lcid.json');
+var inverted = invertKv(all);
+
+exports.from = function (lcidCode) {
+ if (typeof lcidCode !== 'number') {
+ throw new TypeError('Expected a number');
+ }
+
+ return inverted[lcidCode];
+};
+
+exports.to = function (localeId) {
+ if (typeof localeId !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ return all[localeId];
+};
+
+exports.all = all;