Skip to content

Commit eaef450

Browse files
committed
feat: add inBrowser function
1 parent f51f8a2 commit eaef450

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ isCode, // 是否是验证码,长度默认为6,第二个参数可修改
109109
isFunction // 是否是函数
110110
isTrue // 是否是布尔 true 或者是字符 'true'
111111
isURL // 是否是 URL
112+
inBrowser // 是否在浏览器
112113
```
113114
### cloneDeep
114115
```js

src/test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,8 @@ export const isTrue = (val: unknown) => val === true || val === 'true'
114114
export const isURL = (url: string): boolean => {
115115
return /^((ht|f)tps?):\/\/?/.test(url)
116116
}
117+
118+
/**
119+
* 是否在浏览器中
120+
*/
121+
export const inBrowser = typeof window !== 'undefined'

0 commit comments

Comments
 (0)