# jazzxp/ts-util architecture

> Architecture diagram of the GitHub repository jazzxp/ts-util, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jazzxp/ts-util
- Repository: https://github.com/jazzxp/ts-util

## Overview

##### Project type and purpose
- This is a standalone, open-source TypeScript utility library published via npm.
- Its purpose is to provide a collection of reusable helper functions (arrays, objects, strings, try/catch wrappers, and type utilities) along with type definitions for fast, type-safe development.

##### File structure
- Top-level files:
- package.json & pnpm-lock.yaml → npm metadata + lockfile
- tsconfig.json & tsconfig.build.json → compiler configuration
- vitest.config.ts → test runner config
- .github/workflows/* → CI/CD pipelines (build, test, publish)
- src/ → source code organized by feature:
- array.ts + array.test.ts
- funcs.ts + funcs.test.ts
- object.ts + object.test.ts
- strings.ts + strings.test.ts
- tryCatch.ts + tryCatch.test.ts
- types.ts
- index.ts (aggregates & re-exports all modules)

##### README for additional insights
- Describes each module’s API and use cases (e.g., chunkArray, groupBy, type branding).
- Includes code examples showing how consumers import and use these utilities.
- No runtime services or databases—pure code library with a standard publish pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Source Modules
    subgraph "Source Modules"
        direction TB
        ArrayModule["array.ts"]:::src
        FuncsModule["funcs.ts"]:::src
        ObjectModule["object.ts"]:::src
        StringsModule["strings.ts"]:::src
        TryCatchModule["tryCatch.ts"]:::src
        TypesModule["types.ts"]:::src
        IndexModule["index.ts"]:::src
    end

    %% Configuration
    subgraph "Configuration"
        direction TB
        TSConfig["tsconfig.json"]:::config
        TSBuildConfig["tsconfig.build.json"]:::config
        VitestConfig["vitest.config.ts"]:::config
        PackageMetadata["package.json & pnpm-lock.yaml"]:::config
        README["README.md"]:::config
    end

    %% Build & Dist
    subgraph "Build Process"
        direction TB
        TSCompiler["TypeScript Compiler"]:::pipeline
        DistOutput["dist/ (Compiled Output)"]:::src
    end

    %% Test Suite
    subgraph "Tests"
        direction TB
        TestRunner["Vitest Runner"]:::pipeline
        ArrayTest["array.test.ts"]:::test
        FuncsTest["funcs.test.ts"]:::test
        ObjectTest["object.test.ts"]:::test
        StringsTest["strings.test.ts"]:::test
        TryCatchTest["tryCatch.test.ts"]:::test
    end

    %% CI/CD
    subgraph "CI/CD Pipelines"
        direction TB
        BuildWorkflow[".github/workflows/publish.yaml"]:::pipeline
        PublishWorkflow[".github/workflows/publish-npm.yaml"]:::pipeline
    end

    %% External Services
    subgraph "External Services"
        direction TB
        NPM["npm Registry"]:::external
    end

    %% Consumer
    Consumer["Consumer Application"]:::consumer

    %% Relationships
    ArrayModule -->|exports| IndexModule
    FuncsModule -->|exports| IndexModule
    ObjectModule -->|exports| IndexModule
    StringsModule -->|exports| IndexModule
    TryCatchModule -->|exports| IndexModule
    TypesModule -->|exports| IndexModule

    IndexModule -->|compiles with| TSCompiler
    TSConfig -->|configures| TSCompiler
    TSBuildConfig -->|configures| TSCompiler
    TSCompiler -->|outputs| DistOutput

    DistOutput -->|tested by| TestRunner
    ArrayModule -->|tested by| TestRunner
    FuncsModule -->|tested by| TestRunner
    ObjectModule -->|tested by| TestRunner
    StringsModule -->|tested by| TestRunner
    TryCatchModule -->|tested by| TestRunner

    TestRunner --> ArrayTest
    TestRunner --> FuncsTest
    TestRunner --> ObjectTest
    TestRunner --> StringsTest
    TestRunner --> TryCatchTest
    VitestConfig -->|configures| TestRunner

    PackageMetadata -->|metadata| BuildWorkflow
    DistOutput -->|artifact| BuildWorkflow
    BuildWorkflow -->|triggers| PublishWorkflow
    PublishWorkflow -->|publishes| NPM

    Consumer -->|installs| NPM
    Consumer -->|uses| DistOutput

    %% Click Events
    click ArrayModule "https://github.com/jazzxp/ts-util/blob/main/src/array.ts"
    click ArrayTest "https://github.com/jazzxp/ts-util/blob/main/src/array.test.ts"
    click FuncsModule "https://github.com/jazzxp/ts-util/blob/main/src/funcs.ts"
    click FuncsTest "https://github.com/jazzxp/ts-util/blob/main/src/funcs.test.ts"
    click ObjectModule "https://github.com/jazzxp/ts-util/blob/main/src/object.ts"
    click ObjectTest "https://github.com/jazzxp/ts-util/blob/main/src/object.test.ts"
    click StringsModule "https://github.com/jazzxp/ts-util/blob/main/src/strings.ts"
    click StringsTest "https://github.com/jazzxp/ts-util/blob/main/src/strings.test.ts"
    click TryCatchModule "https://github.com/jazzxp/ts-util/blob/main/src/tryCatch.ts"
    click TryCatchTest "https://github.com/jazzxp/ts-util/blob/main/src/tryCatch.test.ts"
    click TypesModule "https://github.com/jazzxp/ts-util/blob/main/src/types.ts"
    click IndexModule "https://github.com/jazzxp/ts-util/blob/main/src/index.ts"
    click TSConfig "https://github.com/jazzxp/ts-util/blob/main/tsconfig.json"
    click TSBuildConfig "https://github.com/jazzxp/ts-util/blob/main/tsconfig.build.json"
    click VitestConfig "https://github.com/jazzxp/ts-util/blob/main/vitest.config.ts"
    click PackageMetadata "https://github.com/jazzxp/ts-util/blob/main/package.json"
    click PackageMetadata "https://github.com/jazzxp/ts-util/blob/main/pnpm-lock.yaml"
    click BuildWorkflow "https://github.com/jazzxp/ts-util/blob/main/.github/workflows/publish.yaml"
    click PublishWorkflow "https://github.com/jazzxp/ts-util/blob/main/.github/workflows/publish-npm.yaml"
    click README "https://github.com/jazzxp/ts-util/blob/main/README.md"

    %% Styles
    classDef src fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef test fill:#90EE90,stroke:#333,stroke-width:1px
    classDef config fill:#D3D33,stroke:#333,stroke-width:1px
    classDef pipeline fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#FF6347,stroke:#333,stroke-width:1px
    classDef consumer fill:#9370DB,stroke:#333,stroke-width:1px
```
