@grundtone/shared

v2.0.0

Published

Shared utilities and helpers for Grundtone

Readme

@grundtone/shared

Shared utilities package for the Grundtone design system. This package contains common helper functions, formatters, and validators used across the design system.

Installation

pnpm add @grundtone/shared

Usage

import { formatCurrency, isValidEmail } from '@grundtone/shared';

// Format currency
const price = formatCurrency(199.99); // "199,99 kr."

// Validate email
const isValid = isValidEmail('[email protected]'); // true

Available Utilities

Formatting

  • formatCurrency(amount: number, currency?: string) - Format number as currency
  • formatDate(date: Date | string) - Format date in Danish locale
  • formatPhoneNumber(phone: string) - Format phone number in Danish format

Validation

  • isValidCPR(cpr: string) - Validate Danish CPR number
  • isValidEmail(email: string) - Validate email address
  • isValidPhoneNumber(phone: string) - Validate Danish phone number

Dependencies

  • @grundtone/core - Core package with types and constants
  • vue - Vue.js framework

Development

  1. Install dependencies:
pnpm install
  1. Start development server:
pnpm dev
  1. Build package:
pnpm build
  1. Run tests:
pnpm test

Contributing

Please refer to the main project README for contribution guidelines.

TypeScript-konfiguration

Denne pakke bruger en specifik tsconfig.json, som udvider rodens tsconfig.build.json. Konfigurationen sikrer at kildekoden i src/ og types i types/ bliver korrekt transpileret og at types genereres i dist/types.

  • outDir: dist
  • rootDir: src
  • Types genereres automatisk ved build

Byg pakken med:

pnpm build