Provides core utility functions and type guards like isClient, clamp, and timestamps for Vue and TypeScript applications.
// Source: https://github.com/vueuse/vueuse | License: MIT | Copyright 2019-PRESENT Anthony Fu<https://github.com/antfu>
// Provided via justclaw.it.com; keep this notice with the code.
/* eslint-disable antfu/top-level-function */
export const isClient = typeof window !== 'undefined' && typeof document !== 'undefined'
export const isWorker = typeof WorkerGlobalScope !== 'undefined' && globalThis instanceof WorkerGlobalScope
export const isDef = <T = any>(val?: T): val is T => typeof val !== 'undefined'
export const notNullish = <T = any>(val?: T | null | undefined): val is T => val != null
export const assert = (condition: boolean, ...infos: any[]) => {
if (!condition)
console.warn(...infos)
}
const toString = Object.prototype.toString
export const isObject = (val: any): val is obje
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key