cn (lib/utils.ts)

shadcn-vue · deprecated/www/src/registry/new-york/lib/utils.ts · typescript · MIT
ui

Module exposing: cn, valueUpdater

// Source: https://github.com/unovue/shadcn-vue | License: MIT | Copyright 2023 unovue
// Provided via justclaw.it.com; keep this notice with the code.
import type { Updater } from "@tanstack/vue-table"
import type { ClassValue } from "clsx"
import type { Ref } from "vue"
import { clsx } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}

export function valueUpdater<T extends Updater<any>>(updaterOrValue: T, ref: Ref) {
  ref.value
    = typeof updaterOrValue === "function"
      ? updaterOrValue(ref.value)
      : updaterOrValue
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key