token.ts

 1import { SingleColorToken, TokenTypes } from "@tokens-studio/types"
 2
 3export function colorToken(name: string, value: string, description?: string): SingleColorToken {
 4    const token: SingleColorToken = {
 5        name,
 6        type: TokenTypes.COLOR,
 7        value,
 8        description,
 9    }
10
11    if (!token.value || token.value === '') throw new Error("Color token must have a value")
12
13    return token
14}