You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 436B

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