Skip to content

Commit

Permalink
Merge pull request #130 from kaimallea/fix-optional-param
Browse files Browse the repository at this point in the history
fix: isMobile() parameter should be optional
  • Loading branch information
kaimallea authored Apr 14, 2020
2 parents 040120e + 08d35e6 commit 5cc13e5
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 5cc13e5

Please sign in to comment.