diff --git a/lib/cartodb/models/dataview/histogram.js b/lib/cartodb/models/dataview/histogram.js index 8624efc5..3d758b17 100644 --- a/lib/cartodb/models/dataview/histogram.js +++ b/lib/cartodb/models/dataview/histogram.js @@ -624,18 +624,23 @@ module.exports = class Histogram extends BaseWidget { offset = this.getOffset(override); } - buckets = result.rows.map(function(row) { - return _.omit( - row, - 'bins_number', - 'bin_width', - 'nulls_count', - 'infinities_count', - 'nans_count', - 'avg_val', - 'timestamp_start' - ); - }); + // TODO: after applying strategy we could use specialized .format() + // in order to know what props we want to expose using destructuring assignment + + const blacklisted = [ + 'bins_number', + 'bin_width', + 'nulls_count', + 'infinities_count', + 'nans_count', + 'avg_val', + 'timestamp_start' + ]; + + buckets = result.rows.map(row => Object.keys(row) + .filter((key) => blacklisted.indexOf(key) < 0) + .reduce((newObj, key) => Object.assign(newObj, { [key]: row[key] }), {}) + ); } return {