import map from 'lodash/map'
import includes from 'lodash/includes'

import type { Languages } from 'config/languages'
import { langsList } from 'config/languages'

export const isSupportedLang = (lang: string): lang is Languages => {
  const supportedLangs = map(langsList, ({ locale }) => locale)
  return includes(supportedLangs, lang)
}
