We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8750dad commit 69e7e60Copy full SHA for 69e7e60
js/src/utils/functions/common.tsx
@@ -69,3 +69,15 @@ export const filterObjKeys = (
69
70
export const isUsingBlockEditor =
71
typeof window?.wp !== 'undefined' && typeof window?.wp?.blocks !== 'undefined'
72
+
73
+export const removeTrailingSlash = (str: string) => {
74
+ if (str.endsWith('/')) {
75
+ // 如果字符串以斜杠结尾,使用 slice 方法去除最后一个字符
76
77
+ return str.slice(0, -1)
78
+ }
79
80
+ // 否则,返回原字符串
81
82
+ return str
83
+}
0 commit comments