# core/selectors/record.selector.ts

> 8 lines of code and 3 definitions.

Tree: Bane's Lab Build Scripts
Language: typescript
Layer: application
Canonical: https://banes-lab.com/anatomy/build-scripts#file-build-scripts-core-selectors-record-selector-ts
Source text: https://banes-lab.com/source/build-scripts/core/selectors/record.selector.ts.txt

Listed in [core/selectors](https://banes-lab.com/api/source/build-scripts/core/selectors.md), after [core/selectors/page.selector.ts](https://banes-lab.com/source/build-scripts/core/selectors/page.selector.ts.md) and before [core/selectors/site.selector.ts](https://banes-lab.com/source/build-scripts/core/selectors/site.selector.ts.md).

## Definitions

- `recordText` (lexical_declaration, line 3, exported)
- `SEPARATOR` (lexical_declaration, line 1)
- `value` (lexical_declaration, line 4, exported)

## Contained in

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

## Used by

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

## Linked from

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

## Source

```typescript
const SEPARATOR = ", ";

export const recordText = function recordText(data: object, key: string): string | null {
    const value: unknown = Reflect.get(data, key);
    if (Array.isArray(value)) {
        return value.length === 0 ? null : value.join(SEPARATOR);
    }
    return typeof value === "string" && value.length > 0 ? value : null;
};
```
