huridocs/uwazi

View on GitHub
app/shared/languages.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { language, elasticLanguages } from 'shared/languagesList';

export default {
  get: language,
  data: Object.keys(elasticLanguages).map(k => elasticLanguages[k]),
  getAll: (purpose = 'elastic') => {
    const unique = (v, i, a) => a.indexOf(v) === i;
    const notNull = v => Boolean(v);
    return Object.keys(elasticLanguages)
      .map(k => elasticLanguages[k][purpose])
      .filter(unique)
      .filter(notNull);
  },
};