Opal-Estate-Pro/node_modules/lcid/index.js
2019-09-13 11:27:52 +07:00

23 lines
436 B
JavaScript
Executable File

'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;