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 427B

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