Skip to content

Commit

Permalink
fix: isMobile() parameter should be optional
Browse files Browse the repository at this point in the history
fix #129
  • Loading branch information
spotify-kai committed Apr 14, 2020
1 parent 040120e commit 08d35e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/isMobile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export type isMobileResult = {

export type IsMobileParameter = UserAgent | Navigator;

export default function isMobile(param: IsMobileParameter): isMobileResult {
export default function isMobile(param?: IsMobileParameter): isMobileResult {
let nav: Navigator = {
userAgent: '',
platform: '',
Expand All @@ -88,7 +88,7 @@ export default function isMobile(param: IsMobileParameter): isMobileResult {
};
} else if (typeof param === 'string') {
nav.userAgent = param;
} else if (param.userAgent) {
} else if (param && param.userAgent) {
nav = {
userAgent: param.userAgent,
platform: param.platform,
Expand Down

0 comments on commit 08d35e6

Please sign in to comment.