mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: update formatWithSlashes function to return "//" for invalid input
This commit is contained in:
parent
520c60a8e7
commit
d6d0664580
@ -30,7 +30,7 @@ export const isRegexString = (str: any) => {
|
|||||||
* Ensures value is wrapped in slashes: /value/
|
* Ensures value is wrapped in slashes: /value/
|
||||||
*/
|
*/
|
||||||
export const formatWithSlashes = (value: string): string => {
|
export const formatWithSlashes = (value: string): string => {
|
||||||
if (!value || typeof value !== "string") return "/";
|
if (!value || typeof value !== "string") return "//";
|
||||||
if (!value.startsWith("/")) value = "/" + value;
|
if (!value.startsWith("/")) value = "/" + value;
|
||||||
if (!value.endsWith("/")) value = value + "/";
|
if (!value.endsWith("/")) value = value + "/";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user