Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 46x 46x 46x 46x 46x 46x 46x 46x 46x 46x 46x 46x 46x 46x 46x 46x 46x 46x 46x 2x 1x 1x 4x 2x 1x 1x 2x 2x 1x 1x 4x 2x 1x 1x 2x 2x 1x 1x 2x 2x 1x 1x 4x 4x 1x 1x 2x 2x 1x 1x 8x 4x 1x 1x 3x 2x 3x 1x 1x 3x 1x 1x 3x 3x 1x 1x 3x 3x 1x 1x 11x 3x 1x 1x 8x 2x 2x 6x 8x 4x 4x 2x 2x 2x 2x 8x 1x 1x 1x 1x 1x 14x 14x 1x 1x 2x 1x 1x 1x 1x 2x 1x 1x 2x 2x 1x 1x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { useInClient } from './common' declare global { interface Window { __wxjs_is_wkwebview?: unknown } } const toString = Object.prototype.toString export function is( val: unknown, type: | 'Null' | 'Undefined' | 'String' | 'Boolean' | 'Number' | 'Array' | 'Function' | 'BigInt' | 'Object' | 'Date' | 'RegExp' | 'Symbol' | 'Promise' | 'Window' | 'global' ) { return toString.call(val) === `[object ${type}]` } export function isDef(val: unknown) { return typeof val === 'undefined' } export function isUnDef(val: unknown) { return !isDef(val) } export function isObject(val: unknown) { return val !== null && is(val, 'Object') } export function isDate(val: unknown) { return is(val, 'Date') } export function isNull(val: unknown) { return val === null } export function isNumber(val: unknown) { return is(val, 'Number') } export function isString(val: unknown) { return is(val, 'String') } export function isFunction(val: unknown) { return typeof val === 'function' } export function isPromise(val: unknown) { if (val instanceof Promise) { return is(val, 'Promise') && isFunction(val.then) && isFunction(val.catch) } else { return false } } export function isBoolean(val: unknown) { return is(val, 'Boolean') } export function isRegExp(val: unknown) { return is(val, 'RegExp') } export function isArray(val: unknown) { return Boolean(val) && Array.isArray(val) } export function isEmpty(val: object | unknown[] | Set<unknown> | Map<unknown, unknown>) { if (isArray(val)) { return (val as unknown[]).length === 0 } if (val instanceof Map || val instanceof Set) { return val.size === 0 } if (isObject(val)) { return Object.keys(val as object).length === 0 } } export const isServer = typeof window === 'undefined' export const isClient = typeof window !== 'undefined' export function isWindow() { return typeof window !== 'undefined' ? is(window, 'Window') || is(window, 'global') : false } export function isElement(val: unknown) { if (val instanceof Element) { return !!val.tagName } else { return false } } export function isImageDom(o: Element) { return o && ['IMAGE', 'IMG'].includes(o.tagName) } export function isTextarea(element: Element) { return element !== null && element.tagName.toLowerCase() === 'textarea' } export function isMobile() { useInClient() return !!navigator.userAgent?.match( // eslint-disable-next-line max-len /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i ) } export function isiOS() { useInClient() const u = navigator.userAgent // ios终端 return !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) } export function isAndroid() { useInClient() const u = navigator.userAgent.toLowerCase() return u.includes('android') || u.includes('adr') } export function isWechat() { useInClient() const ua = navigator.userAgent.toLowerCase() return ua.includes('micromessenger') } export function isLine() { useInClient() const ua = navigator.userAgent.toLowerCase() return ua.includes('line') } export function isIOSWechat() { useInClient() return Boolean(window?.__wxjs_is_wkwebview) } /** * 判断是否在facebook内置浏览器 */ export function isFacebook() { useInClient() const ua = navigator.userAgent.toLowerCase() return ua.includes('facebookexternalhit') } /** * 判断是否在whatsapp内置浏览器 */ export function isWhatsapp() { useInClient() const ua = navigator.userAgent.toLowerCase() return ua.includes('whatsapp') } /** * 判断是否在twitter内置浏览器 */ export function isTwitter() { useInClient() const ua = navigator.userAgent.toLowerCase() return ua.includes('twitter') } export function isMac() { useInClient() const ua = navigator.userAgent.toLowerCase() return /Mac OS/i.test(ua) } export function isWin() { useInClient() const ua = navigator.userAgent.toLowerCase() return ua.indexOf('win64') > -1 } |