Initial commit
[yaffs-website] / node_modules / lcid / index.js
1 'use strict';
2 var invertKv = require('invert-kv');
3 var all = require('./lcid.json');
4 var inverted = invertKv(all);
5
6 exports.from = function (lcidCode) {
7         if (typeof lcidCode !== 'number') {
8                 throw new TypeError('Expected a number');
9         }
10
11         return inverted[lcidCode];
12 };
13
14 exports.to = function (localeId) {
15         if (typeof localeId !== 'string') {
16                 throw new TypeError('Expected a string');
17         }
18
19         return all[localeId];
20 };
21
22 exports.all = all;