# core/converters/grammar.converter.ts

> 10 lines of code and 2 definitions.

Tree: Code Parse
Language: typescript
Layer: processing
Canonical: https://banes-lab.com/anatomy/code-parse#file-code-parse-core-converters-grammar-converter-ts
Source text: https://banes-lab.com/source/code-parse/core/converters/grammar.converter.ts.txt

Listed in [core/converters](https://banes-lab.com/api/source/code-parse/core/converters.md), before [core/converters/syntax.converter.ts](https://banes-lab.com/source/code-parse/core/converters/syntax.converter.ts.md).

## Definitions

- `extensionMapOf` (lexical_declaration, line 3, exported)
- `entries` (lexical_declaration, line 4, exported)

## Contained in

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

## Source

```typescript
import type { BuildResult } from "#types/grammar.types";

export const extensionMapOf = function extensionMapOf(results: readonly BuildResult[]): Record<string, string[]> {
    const entries = results
        .filter((result) => result.fileTypes.length > 0)
        .map((result): [string, string[]] => [
            result.lang,
            [...new Set(result.fileTypes)].toSorted((a, b) => a.localeCompare(b)),
        ]);
    return Object.fromEntries(entries.toSorted(([a], [b]) => a.localeCompare(b)));
};
```
