# unjs/scule architecture

> Architecture diagram of the GitHub repository unjs/scule, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unjs/scule
- Repository: https://github.com/unjs/scule

## Overview

Scule is a small TypeScript string-case utility library. A caller supplies a string (or, for several utilities, word array) to an exported function and receives transformed text; `splitByCase` provides the shared word-splitting behavior. The README documents the public utilities, while the sampled implementation shows their direct helper calls. The type-level case transformations live separately in `src/types.ts`; there are no stores or external service integrations.

Main entry points: [`src/index.ts`](https://github.com/unjs/scule/blob/main/src/index.ts) (Word splitter), [`src/types.ts`](https://github.com/unjs/scule/blob/main/src/types.ts) (Type contracts)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Library caller"))
node_case_utils["Case utilities<br/>[index.ts]"]
node_split["Word splitter<br/>[index.ts]"]
node_uppercase["Uppercase check<br/>[index.ts]"]
node_first_char["First-character helpers<br/>[index.ts]"]
node_pascal["Pascal case<br/>[index.ts]"]
node_camel["Camel case<br/>[index.ts]"]
node_kebab["Kebab case<br/>[index.ts]"]
node_snake["Snake case<br/>[index.ts]"]
node_flat["Flat case<br/>[index.ts]"]
node_train["Train case<br/>[index.ts]"]
node_title["Title case<br/>[index.ts]"]
node_type_contracts["Type contracts<br/>[types.ts]"]

node_caller -->|"calls exported utilities"| node_case_utils
node_case_utils -->|"splits words"| node_split
node_split -->|"checks characters"| node_uppercase
node_case_utils -->|"changes first character"| node_first_char
node_case_utils -->|"exports types"| node_type_contracts
node_pascal -->|"splits input"| node_split
node_pascal -->|"capitalizes words"| node_first_char
node_camel -->|"converts via Pascal"| node_pascal
node_camel -->|"lowercases first"| node_first_char
node_kebab -->|"splits input"| node_split
node_snake -->|"joins with underscore"| node_kebab
node_flat -->|"joins without separator"| node_kebab
node_train -->|"splits input"| node_split
node_train -->|"capitalizes words"| node_first_char
node_title -->|"splits input"| node_split
node_title -->|"capitalizes words"| node_first_char

click node_case_utils "https://github.com/unjs/scule/blob/main/src/index.ts"
click node_split "https://github.com/unjs/scule/blob/main/src/index.ts"
click node_uppercase "https://github.com/unjs/scule/blob/main/src/index.ts"
click node_first_char "https://github.com/unjs/scule/blob/main/src/index.ts"
click node_pascal "https://github.com/unjs/scule/blob/main/src/index.ts"
click node_camel "https://github.com/unjs/scule/blob/main/src/index.ts"
click node_kebab "https://github.com/unjs/scule/blob/main/src/index.ts"
click node_snake "https://github.com/unjs/scule/blob/main/src/index.ts"
click node_flat "https://github.com/unjs/scule/blob/main/src/index.ts"
click node_train "https://github.com/unjs/scule/blob/main/src/index.ts"
click node_title "https://github.com/unjs/scule/blob/main/src/index.ts"
click node_type_contracts "https://github.com/unjs/scule/blob/main/src/types.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_caller toneIndigo
class node_case_utils,node_split,node_uppercase,node_first_char,node_pascal,node_camel,node_kebab,node_snake,node_flat,node_train,node_title,node_type_contracts toneTeal
```

## Components

### Other components

- **Library caller**
- [Case utilities](https://github.com/unjs/scule/blob/main/src/index.ts): `src/index.ts`
- [Word splitter](https://github.com/unjs/scule/blob/main/src/index.ts): `src/index.ts`
- [Uppercase check](https://github.com/unjs/scule/blob/main/src/index.ts): `src/index.ts`
- [First-character helpers](https://github.com/unjs/scule/blob/main/src/index.ts): `src/index.ts`
- [Pascal case](https://github.com/unjs/scule/blob/main/src/index.ts): `src/index.ts`
- [Camel case](https://github.com/unjs/scule/blob/main/src/index.ts): `src/index.ts`
- [Kebab case](https://github.com/unjs/scule/blob/main/src/index.ts): `src/index.ts`
- [Snake case](https://github.com/unjs/scule/blob/main/src/index.ts): `src/index.ts`
- [Flat case](https://github.com/unjs/scule/blob/main/src/index.ts): `src/index.ts`
- [Train case](https://github.com/unjs/scule/blob/main/src/index.ts): `src/index.ts`
- [Title case](https://github.com/unjs/scule/blob/main/src/index.ts): `src/index.ts`
- [Type contracts](https://github.com/unjs/scule/blob/main/src/types.ts): `src/types.ts`

## Connections

- Library caller → Case utilities: calls exported utilities (evidence: `README.md`)
- Case utilities → Word splitter: splits words (evidence: `src/index.ts`)
- Word splitter → Uppercase check: checks characters (evidence: `src/index.ts`)
- Case utilities → First-character helpers: changes first character (evidence: `src/index.ts`)
- Case utilities → Type contracts: exports types (evidence: `src/index.ts`)
- Pascal case → Word splitter: splits input (evidence: `src/index.ts`)
- Pascal case → First-character helpers: capitalizes words (evidence: `src/index.ts`)
- Camel case → Pascal case: converts via Pascal (evidence: `src/index.ts`)
- Camel case → First-character helpers: lowercases first (evidence: `src/index.ts`)
- Kebab case → Word splitter: splits input (evidence: `src/index.ts`)
- Snake case → Kebab case: joins with underscore (evidence: `src/index.ts`)
- Flat case → Kebab case: joins without separator (evidence: `src/index.ts`)
- Train case → Word splitter: splits input (evidence: `src/index.ts`)
- Train case → First-character helpers: capitalizes words (evidence: `src/index.ts`)
- Title case → Word splitter: splits input (evidence: `src/index.ts`)
- Title case → First-character helpers: capitalizes words (evidence: `src/index.ts`)
