From 4c56129063fb6b2063113d7dd527842f7ccd2540 Mon Sep 17 00:00:00 2001 From: manubo Date: Wed, 9 Oct 2019 17:01:15 +0200 Subject: [PATCH] Ignore non-alphanumeric chars finding project by identifier --- src/js/utils/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js/utils/index.js b/src/js/utils/index.js index 20127eb..be245f3 100644 --- a/src/js/utils/index.js +++ b/src/js/utils/index.js @@ -23,6 +23,7 @@ export const ERROR_UNKNOWN = "unknown" export const noop = () => null export const asArray = input => (Array.isArray(input) ? input : [input]) +export const removeNonAlphanumChars = input => String(input ?? "").replace(/[\W_]/g, "") export const findProjectBy = prop => val => projects => { if (!val) { @@ -30,7 +31,11 @@ export const findProjectBy = prop => val => projects => { } return compose( - find(pathEq(prop, val)), + find( + project => + project[prop] === val || + removeNonAlphanumChars(project[prop]) === removeNonAlphanumChars(val), + ), flatMap(get("options")), )(projects) }