lib/index.js
function sumObjectValues(object, depth, level = 1) {
    let sum = 0;
    for (const i in object) {
        const value = object[i];
        if (isNumber(value)) {
            sum += parseFloat(value);
        } else if (isObject(value) && (depth < 1 || depth > level)) {
            sum += sumObjectValues(value, depth, ++level);
            --level;
        }
    }
    return sum;
}
function sumObjectValues(object, depth, level = 1) {
    let sum = 0;
    for (const i in object) {
        const value = object[i];
        if (isNumber(value)) {
            sum += parseFloat(value);
        } else if (isObject(value) && (depth < 1 || depth > level)) {
            sum += sumObjectValues(value, depth, ++level);
            --level;
        }
    }
    return sum;
}
function sumObjectValues ( object , depth , level = 1 ) { let sum = 0 ; for ( const i in object ) { const value = object [ i ] ; if ( isNumber ( value ) ) { sum += parseFloat ( value ) ; } else if ( isObject ( value ) && ( depth < 1 || depth > level ) ) { sum += sumObjectValues ( value , depth , ++ level ) ; -- level ; } } return sum ; }
Recursive function that computes the sum
of all numeric values in an object

@param {Object} object
@param {Integer} depth
@param {Integer} level
@returns {Number}
Recursive function that computes the sum of all numeric values in an object