lib/transformations.js
function percentBy(valueMapper) {
    var valueSetter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

    return function (input) {
        if (input.isEmpty()) {
            return input;
        }
        var percents = input.map(valueMapper).update(percent());

        if (!valueSetter) {
            return percents;
        }
        return input.map(function (item, kk, iter) {
            var value = percents.get(kk);
            return valueSetter(item, value, kk, iter);
        });
    };
}
function percentBy(valueMapper) {
    var valueSetter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

    return function (input) {
        if (input.isEmpty()) {
            return input;
        }
        var percents = input.map(valueMapper).update(percent());

        if (!valueSetter) {
            return percents;
        }
        return input.map(function (item, kk, iter) {
            var value = percents.get(kk);
            return valueSetter(item, value, kk, iter);
        });
    };
}
function percentBy ( valueMapper ) { var valueSetter = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : null ; return function ( input ) { if ( input . isEmpty ( ) ) { return input ; } var percents = input . map ( valueMapper ) . update ( percent ( ) ) ; if ( ! valueSetter ) { return percents ; } return input . map ( function ( item , kk , iter ) { var value = percents . get ( kk ) ; return valueSetter ( item , value , kk , iter ) ; } ) ; } ; }
Like `percent`, but also accepts a `valueMapper` function which allows you to process child properties.
@param {ValueMapper} valueMapper
@param {ValueSetter} valueSetter
@return {InputFunction}
Like percent but also accepts a valueMapper function which allows you to process child properties .