Function reduce

  • Reduces the input object using the reducer (and optional initial value) and return the reduced value.

    Parameters

    • object: any
    • reducer: ICallable
    • Optional result: any

    Returns any

    Example

    import { reduce } from 'apption'
    const r = mapValues({ a: 1, b: 2, c: 3 }, (r, k, v) => r + (v * v), 0);
    console.log(r) // 14