• Returns the sum value of a given path

    Example

    sum([1, 2, 3]); // 6
    

    Example

    sum([{a: 1}, {a: 2}, {a: 3}], 'a'); // 6
    

    Example

    sum([{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}], 'a.b'); // 6
    

    Type Parameters

    • Value

    • Path extends string = PathT<Value>

    Parameters

    • arr: Value[]
    • Optional path: Path

    Returns number

Generated using TypeDoc