core/selectors/record.selector.ts

core/selectors/record.selector.ts is a file in Bane's Lab Build Scripts. 8 lines of code and 3 definitions.

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;
};