20 lines
551 B
TypeScript
20 lines
551 B
TypeScript
import type { ClassValue } from 'clsx';
|
|
// eslint-disable-next-line unicorn/prefer-node-protocol
|
|
import { Buffer } from 'buffer';
|
|
import { clsx } from 'clsx';
|
|
import { twMerge } from 'tailwind-merge';
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs));
|
|
}
|
|
|
|
export function base64ToUtf8(base64: string): string {
|
|
return new TextDecoder('utf-8').decode(
|
|
Uint8Array.from(Buffer.from(base64, 'base64')),
|
|
);
|
|
}
|
|
|
|
export function utf8ToBase64(utf8: string): string {
|
|
return Buffer.from(utf8, 'utf-8').toString('base64');
|
|
}
|