npm.io
0.2.0 • Published 8 years ago

your-is-mobile

Licence
MIT
Version
0.2.0
Deps
0
Vulns
0
Weekly
0

your-is-mobile

npm i your-is-mobile

isMobile([userAgent])

  • userAgent <string> 浏览器 ua 信息。默认 navigator.userAgent
  • return <boolean> 是否移动端环境

判断当前是否移动端浏览器环境

import isMobile from 'your-is-mobile'

// 当前环境
isMobile()

// 手动传入
isMobile('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36')