src/operator/group-by.js
function getReducerObj (dataModel, reducers = {}) {
    const retObj = {};
    const fieldStore = dataModel.getFieldspace();
    const measures = fieldStore.getMeasure();
    const defReducer = reducerStore.defaultReducer();

    Object.keys(measures).forEach((measureName) => {
        if (typeof reducers[measureName] !== 'string') {
            reducers[measureName] = measures[measureName].defAggFn();
        }
        const reducerFn = reducerStore.resolve(reducers[measureName]);
        if (reducerFn) {
            retObj[measureName] = reducerFn;
        } else {
            retObj[measureName] = defReducer;
            reducers[measureName] = defaultReducerName;
        }
    });
    return retObj;
}
function getReducerObj (dataModel, reducers = {}) {
    const retObj = {};
    const fieldStore = dataModel.getFieldspace();
    const measures = fieldStore.getMeasure();
    const defReducer = reducerStore.defaultReducer();

    Object.keys(measures).forEach((measureName) => {
        if (typeof reducers[measureName] !== 'string') {
            reducers[measureName] = measures[measureName].defAggFn();
        }
        const reducerFn = reducerStore.resolve(reducers[measureName]);
        if (reducerFn) {
            retObj[measureName] = reducerFn;
        } else {
            retObj[measureName] = defReducer;
            reducers[measureName] = defaultReducerName;
        }
    });
    return retObj;
}
function getReducerObj ( dataModel , reducers = { } ) { const retObj = { } ; const fieldStore = dataModel . getFieldspace ( ) ; const measures = fieldStore . getMeasure ( ) ; const defReducer = reducerStore . defaultReducer ( ) ; Object . keys ( measures ) . forEach ( ( measureName ) => { if ( typeof reducers [ measureName ] !== 'string' ) { reducers [ measureName ] = measures [ measureName ] . defAggFn ( ) ; } const reducerFn = reducerStore . resolve ( reducers [ measureName ] ) ; if ( reducerFn ) { retObj [ measureName ] = reducerFn ; } else { retObj [ measureName ] = defReducer ; reducers [ measureName ] = defaultReducerName ; } } ) ; return retObj ; }
This sanitize the reducer provide by the user and create a common type of object.
user can give function Also
@param  {DataModel} dataModel     dataModel to worked on
@param  {Object|function} [reducers={}] reducer provided by the users
@return {Object}               object containing reducer function for every measure
This sanitize the reducer provide by the user and create a common type of object . user can give function Also