From c4296c7ee7a0ef1d0c545cf52919cc4235f3e65f Mon Sep 17 00:00:00 2001 From: briandennis Date: Sat, 16 Sep 2017 01:05:21 -0500 Subject: [PATCH] add language hash --- lib/constants.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/constants.js b/lib/constants.js index 5deebb3..9056fbc 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -233,6 +233,8 @@ export const LANGUAGES = [ } ] +export const LANGUAGE_HASH = toHash(LANGUAGES) + export const DEFAULT_LANGUAGE = { name: 'Auto' } export const COLORS = { @@ -261,3 +263,13 @@ if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') { } }) } + +function toHash (list) { + return list.reduce((accum, item) => { + if (item.module) { + accum[item.module] = item + } + + return accum + }, {}) +} \ No newline at end of file