From de398901f3edd2a629bfbe56650e7dd552e5dbfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Sa=C5=A1ek?= Date: Mon, 14 Dec 2020 19:04:41 +0100 Subject: [PATCH] Add isPluginInstalled function --- src/index.js | 1 + src/utils/isPluginInstalled.js | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 src/utils/isPluginInstalled.js diff --git a/src/index.js b/src/index.js index 651fdf9..3107c2d 100644 --- a/src/index.js +++ b/src/index.js @@ -70,6 +70,7 @@ export { ErrorMessage } from "./utils/ErrorMessage"; export { useClickOutside } from "./utils/hooks"; export { toLocaleDateString } from "./utils/datetime"; export { displayCard } from "./utils/displayCard"; +export { isPluginInstalled } from "./utils/isPluginInstalled"; // Foris URL export { ForisURLs, REFORIS_URL_PREFIX } from "./utils/forisUrls"; diff --git a/src/utils/isPluginInstalled.js b/src/utils/isPluginInstalled.js new file mode 100644 index 0000000..8193c99 --- /dev/null +++ b/src/utils/isPluginInstalled.js @@ -0,0 +1,9 @@ +/* + * Copyright (C) 2020 CZ.NIC z.s.p.o. (http://www.nic.cz/) + * + * This is free software, licensed under the GNU General Public License v3. + * See /LICENSE for more information. + */ + +export const isPluginInstalled = (pluginName) => + ForisPlugins.some((plugin) => plugin.name === pluginName);