Add extra check for String types in createDeepLinkPath. Add trim() call on passed-in value in createDeepLinkPath. Added unit tests for new deep link util functions.

This commit is contained in:
Owen Conti
2017-09-15 17:17:45 -06:00
parent acac3ee875
commit 33ee880f36
2 changed files with 52 additions and 2 deletions

View File

@@ -652,5 +652,5 @@ export const shallowEqualKeys = (a,b, keys) => {
})
}
export const createDeepLinkPath = (str) => str ? str.replace(/\s/g, "_") : ""
export const createDeepLinkPath = (str) => typeof str == "string" || str instanceof String ? str.trim().replace(/\s/g, "_") : ""
export const escapeDeepLinkPath = (str) => cssEscape( createDeepLinkPath(str) )