mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
Merge d6d0664580
into e3094742a2
This commit is contained in:
commit
33f92b8069
@ -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) 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 + "/";
|
||||||
|
|
||||||
@ -40,12 +40,17 @@ export const formatWithSlashes = (value: string): string => {
|
|||||||
/**
|
/**
|
||||||
* Extracts the inner regex from /.../
|
* Extracts the inner regex from /.../
|
||||||
*/
|
*/
|
||||||
export const extractRegexBody = (value: string | undefined): string => {
|
export const extractRegexBody = (value: string | undefined): string => {
|
||||||
if (value && value.startsWith("/") && value.endsWith("/")) {
|
if (
|
||||||
|
value &&
|
||||||
|
typeof value === "string" &&
|
||||||
|
value.startsWith("/") &&
|
||||||
|
value.endsWith("/")
|
||||||
|
) {
|
||||||
return value.slice(1, -1);
|
return value.slice(1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user