# core/converters/architecture.index.converter.ts

> 17 lines of code and 4 definitions.

Tree: Bane's Lab Build Scripts
Language: typescript
Layer: processing
Canonical: https://banes-lab.com/anatomy/build-scripts#file-build-scripts-core-converters-architecture-index-converter-ts
Source text: https://banes-lab.com/source/build-scripts/core/converters/architecture.index.converter.ts.txt

Listed in [core/converters](https://banes-lab.com/api/source/build-scripts/core/converters.md), after [core/converters/anatomy.index.converter.ts](https://banes-lab.com/source/build-scripts/core/converters/anatomy.index.converter.ts.md) and before [core/converters/base.converter.ts](https://banes-lab.com/source/build-scripts/core/converters/base.converter.ts.md).

## Definitions

- `archIndexOf` (lexical_declaration, line 3, exported)
- `index` (lexical_declaration, line 4, exported)
- `categoryLabelsOf` (lexical_declaration, line 13, exported)
- `labels` (lexical_declaration, line 14, exported)

## Contained in

- [core/converters](https://banes-lab.com/anatomy/build-scripts/folder-build-scripts-core-converters.md)

## Source

```typescript
import { type GovlabContext, type Principle, slugify } from "@govlab/context";

export const archIndexOf = function archIndexOf(context: GovlabContext): ReadonlyMap<string, Principle> {
    const index = new Map<string, Principle>();
    for (const principle of context.arch.all()) {
        for (const key of [principle.id, principle.name, ...(principle.aliases ?? [])]) {
            index.set(slugify(key), principle);
        }
    }
    return index;
};

export const categoryLabelsOf = function categoryLabelsOf(context: GovlabContext): ReadonlyMap<string, string> {
    const labels = new Map<string, string>();
    for (const principle of context.arch.all()) {
        labels.set(slugify(principle.category), principle.category);
    }
    return labels;
};
```
