# core/resolvers/icons.resolver.ts

> 25 lines of code and 5 definitions.

Tree: Bane's Lab Build Scripts
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/build-scripts#file-build-scripts-core-resolvers-icons-resolver-ts
Source text: https://banes-lab.com/source/build-scripts/core/resolvers/icons.resolver.ts.txt

Listed in [core/resolvers](https://banes-lab.com/api/source/build-scripts/core/resolvers.md), after [core/resolvers/graph.resolver.ts](https://banes-lab.com/source/build-scripts/core/resolvers/graph.resolver.ts.md) and before [core/resolvers/link.resolver.ts](https://banes-lab.com/source/build-scripts/core/resolvers/link.resolver.ts.md).

## Definitions

- `codepointOf` (lexical_declaration, line 13, exported)
- `value` (lexical_declaration, line 14, exported)
- `iconSource` (lexical_declaration, line 21, exported)
- `fontSource` (lexical_declaration, line 25, exported)
- `fonts` (lexical_declaration, line 26, exported)

## Contained in

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

## Uses

- [configuration/strings/icons.strings.ts](https://banes-lab.com/source/build-scripts/configuration/strings/icons.strings.ts.md)

## Used by

- [core/formatters/icons.formatter.ts](https://banes-lab.com/source/build-scripts/core/formatters/icons.formatter.ts.md)

## Linked from

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

## Source

```typescript
import {
    CODEPOINTS_SPECIFIER,
    FONT_FILE,
    FONT_FOLDER,
    ICON_PREFIX,
    SVG_EXTENSION,
    SVG_FOLDER,
} from "#configuration/constants/icons.constants";
import codepoints from "bootstrap-icons/font/bootstrap-icons.json" with { type: "json" };
import { fileURLToPath } from "node:url";
import { unknownGlyph } from "#configuration/strings/icons.strings";

export const codepointOf = function codepointOf(name: string): number {
    const value: unknown = Reflect.get(codepoints, name);
    if (typeof value !== "number") {
        throw new TypeError(unknownGlyph(ICON_PREFIX + name));
    }
    return value;
};

export const iconSource = function iconSource(name: string): string {
    return fileURLToPath(new URL(SVG_FOLDER + name + SVG_EXTENSION, import.meta.resolve(CODEPOINTS_SPECIFIER)));
};

export const fontSource = function fontSource(): string {
    const fonts = new URL(FONT_FOLDER, import.meta.resolve(CODEPOINTS_SPECIFIER));
    return fileURLToPath(new URL(FONT_FILE, fonts));
};
```
