From 67034543567feab4f521183a29a988be139a1e08 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Wed, 18 Oct 2017 20:35:00 +0200 Subject: [PATCH] Fixed Flow errors temporarily --- .../components/Material/Search/Result.jsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/assets/javascripts/components/Material/Search/Result.jsx b/src/assets/javascripts/components/Material/Search/Result.jsx index 3125df44b..98b396200 100644 --- a/src/assets/javascripts/components/Material/Search/Result.jsx +++ b/src/assets/javascripts/components/Material/Search/Result.jsx @@ -50,11 +50,16 @@ const truncate = (string, n) => { /** * Return the meta tag value for the given key * - * @param {String} key - Meta name - * @return {String} Meta content value + * @param {string} key - Meta name + * @param {string} [_] - Stop Flow complaining (TODO) + * + * @return {string} Meta content value */ -const i18n = key => { - return document.querySelector(`[name=i18n-${key}]`).content +const i18n = (key, _) => { // eslint-disable-line no-unused-vars + const meta = document.querySelector(`[name=i18n-${key}]`) + if (!(meta instanceof HTMLMetaElement)) + throw new ReferenceError + return meta.content } /* ----------------------------------------------------------------------------