• Returns the average value of a given path

    Example

    average([1, 2, 3]); // 2
    

    Example

    average([{a: 1}, {a: 2}, {a: 3}], "a"); // 2
    

    Example

    average([{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}], "a.b"); // 2
    

    Type Parameters

    • Value

    • Path extends string = PathT<Value>

    Parameters

    • array: Value[]
    • Optional path: Path

    Returns number

Generated using TypeDoc