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 5da9b66 commit 8c18ad9Copy full SHA for 8c18ad9
src/utils/is.ts
@@ -103,3 +103,12 @@ export const isUrl = (path: string): boolean => {
103
export const isDark = (): boolean => {
104
return window.matchMedia('(prefers-color-scheme: dark)').matches
105
}
106
+
107
+// 是否是图片链接
108
+export const isImgPath = (path: string): boolean => {
109
+ return /(https?:\/\/|data:image\/).*?\.(png|jpg|jpeg|gif|svg|webp|ico)/gi.test(path)
110
+}
111
112
+export const isEmptyVal = (val: any): boolean => {
113
+ return val === '' || val === null || val === undefined
114
0 commit comments