multilingual-game-words
Version:
Words for games like taboo/pictionary/charades/catchphrase/etc in many different languages.
250 lines (249 loc) • 3.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWordData = exports.verifySupportedLang = void 0;
require("isomorphic-fetch");
const supportedLangs = [
'en',
'ab',
'ady',
'af',
'sq',
'am',
'ar',
'an',
'hy',
'ast',
'av',
'ay',
'az',
'ba',
'eu',
'be',
'bn',
'br',
'bg',
'my',
'bua',
'ca',
'ce',
'chr',
'yue',
'dng',
'zh-CN',
'zh-TW',
'cv',
'kw',
'crh',
'cs',
'da',
'dv',
'nl',
'chm',
'eo',
'et',
'fo',
'fi',
'fr',
'gag',
'gl',
'ka',
'de',
'el',
'grc',
'kl',
'gu',
'ht',
'ha',
'haw',
'he',
'hil',
'hi',
'hu',
'is',
'io',
'id',
'inh',
'ia',
'ie',
'iu',
'ga',
'it',
'ja',
'jv',
'kbd',
'xal',
'kn',
'krc',
'csb',
'kk',
'kjh',
'km',
'koi',
'ko',
'kum',
'ku',
'ckb',
'ky',
'lo',
'ltg',
'la',
'lv',
'lez',
'lij',
'li',
'lt',
'luy',
'lb',
'mk',
'mg',
'ms',
'ml',
'mt',
'gv',
'mi',
'mr',
'mdf',
'mn',
'nah',
'nv',
'ne',
'nog',
'se',
'nn',
'nov',
'oci',
'oj',
'or',
'os',
'ps',
'fa',
'pl',
'pt',
'pa',
'qu',
'ro',
'rm',
'ru',
'rue',
'sgs',
'sa',
'srd',
'sco',
'gd',
'sr',
'sn',
'cjs',
'scn',
'sd',
'si',
'sms',
'sk',
'sl',
'so',
'dsb',
'hsb',
'sot',
'alt',
'es',
'sw',
'sv',
'tl',
'tg',
'ta',
'tt',
'te',
'th',
'bo',
'ti',
'tpi',
'tr',
'tk',
'tyv',
'udm',
'ukr',
'ur',
'ug',
'uz',
'vep',
'vi',
'vo',
'wa',
'cy',
'fy',
'wo',
'xh',
'yi',
'yo',
'zza',
'za',
'zu',
'arz',
'fur',
'got',
'sga',
'ist',
'ang',
'acw',
'arc',
'ovd',
'ilo',
'lld',
'lad',
'khb',
'frr',
'cu',
'orv',
'non',
'sm',
'su',
'vec',
'ain',
'ary',
'hak',
'cdo',
'nan',
'wuu',
'syc',
'cop',
'co',
'dlm',
'gsw',
'gn',
'ln',
'mnc',
'mwl',
'ota',
'rom',
'stq',
'sva',
'syl',
'wym',
'yai',
'yua',
'rup',
'nb',
'mel',
'ny',
'fro',
'zdj',
'fj',
'bal',
'ewe',
'ccc',
'ceb',
'twf',
'esu',
'war',
];
const supportedSet = new Set(supportedLangs);
function verifySupportedLang(lang) {
if (!supportedSet.has(lang)) {
throw new Error(`Language ${lang} is not supported.`);
}
return lang;
}
exports.verifySupportedLang = verifySupportedLang;
async function getWordData(lang) {
return await fetch(`https://s3.us-east-2.amazonaws.com/data.languagegam.es/words/${lang}.json`).then((x) => x.json());
}
exports.getWordData = getWordData;