📄 is¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 🔧 Functions | 11 |
| 📊 Variables & Constants | 3 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/shared/utils/is.ts
Variables & Constants¶
| Name | Type | Kind | Value | Exported |
|---|---|---|---|---|
isClient |
boolean |
const | typeof window !== 'undefined' && typeof document !== 'undefined' |
✓ |
isWorker |
boolean |
const | typeof WorkerGlobalScope !== 'undefined' && globalThis instanceof WorkerGloba... |
✓ |
toString |
() => string |
const | Object.prototype.toString |
✗ |
Functions¶
isDef(val: T): val is T¶
Parameters:
valT
Returns: val is T
notNullish(val: T | null | undefined): val is T¶
Parameters:
valT | null | undefined
Returns: val is T
assert(condition: boolean, infos: any[]): void¶
Parameters:
conditionbooleaninfosany[]
Returns: void
Calls:
console.warn
isObject(val: any): val is object¶
Parameters:
valany
Returns: val is object
now(): number¶
Returns: number
Calls:
Date.now
timestamp(): number¶
Returns: number
clamp(n: number, min: number, max: number): number¶
Parameters:
nnumberminnumbermaxnumber
Returns: number
Calls:
Math.min
noop(): void¶
Returns: void
rand(min: number, max: number): number¶
Parameters:
minnumbermaxnumber
Returns: number
Calls:
Math.ceilMath.floorMath.random
Code
hasOwn(val: T, key: K): key is K¶
Parameters:
valTkeyK
Returns: key is K
Calls:
Object.hasOwn
getIsIOS(): boolean¶
Returns: boolean
Calls:
/iP(?:ad|hone|od)/.test/iPad|Macintosh/.test
Internal Comments:
// The new iPad Pro Gen3 does not identify itself as iPad, but as Macintosh.
// https://github.com/vueuse/vueuse/issues/3577
Code
function getIsIOS(): boolean {
return isClient && !!window?.navigator?.userAgent && (
(/iP(?:ad|hone|od)/.test(window.navigator.userAgent))
// The new iPad Pro Gen3 does not identify itself as iPad, but as Macintosh.
// https://github.com/vueuse/vueuse/issues/3577
|| (window?.navigator?.maxTouchPoints > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent))
)
}
Generated by Syntax Scribe