Arize Phoenix TS
    Preparing search index...

    Type Alias ValueGetter<DataType>

    ValueGetter: string | ((data: DataType) => any)

    A value extractor that can retrieve data from an object using various methods.

    This type supports multiple ways to extract values from your data structure:

    • String paths: Simple property names, dot notation, or JSONPath expressions
    • Function extractors: Custom transformation functions

    Type Parameters

    • DataType extends Record<string, unknown>

      The type of the data object to extract values from

    Simple property access:

    const getter: ValueGetter<{ name: string }> = "name";
    

    Dot notation for nested properties:

    const getter: ValueGetter<{ user: { profile: { name: string } } }> = "user.profile.name";
    

    Array element access:

    const getter: ValueGetter<{ items: string[] }> = "items[0]";
    

    JSONPath expression:

    const getter: ValueGetter<{ items: Array<{ id: number }> }> = "$.items[*].id";
    

    Function-based extraction:

    const getter: ValueGetter<{ firstName: string; lastName: string }> =
    (data) => `${data.firstName} ${data.lastName}`;

    Complex transformation:

    const getter: ValueGetter<{ scores: number[] }> =
    (data) => data.scores.reduce((a, b) => a + b, 0) / data.scores.length;