# core/converters/payload.converter.ts

> 13 lines of code and 1 definition.

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

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

## Definitions

- `textualize` (lexical_declaration, line 3, exported)

## Contained in

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

## Source

```typescript
import type { Inline } from "#types/site.types";

export const textualize = function textualize(value: unknown, inline: Inline): unknown {
    if (typeof value === "string") {
        return inline(value);
    }
    if (Array.isArray(value)) {
        return value.map((entry: unknown) => textualize(entry, inline));
    }
    if (typeof value === "object" && value !== null) {
        return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, textualize(entry, inline)]));
    }
    return value;
};
```
