Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const splittedLang = lang.split(splitLangRgx);
if (splittedLang.length < 1) {
return lang;
}
let standardLang =
splittedLang[0].length === 3
? alpha3TToAlpha2(splittedLang[0])
: splittedLang[0];
if (splittedLang.length === 1) {
return standardLang;
}
let standardCountry =
splittedLang[1].length === 3
? alpha3ToAlpha2(splittedLang[1])
: splittedLang[1];
return `${standardLang}-${standardCountry}`;
}
getLocation: function () {
const user = this.user
let state = '', country = ''
const countries = require('i18n-iso-countries')
if (user.country_code) {
const countryAlpha2 = countries.alpha3ToAlpha2(user.country_code)
const countryData = iso3166.data[countryAlpha2]
let stateData
if (countryData && user.country_subdivision_code) {
stateData = countryData.sub[user.country_subdivision_code]
}
state = stateData ? stateData.name : ''
country = countryData ? countryData.name : ''
}
const location = `${state ? state + ', ' : ''}${country}`
return location || ''
},
fetchChallengeGames() {