您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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;