Skip to content

Commit

Permalink
add aggregation types average, min and max
Browse files Browse the repository at this point in the history
  • Loading branch information
turnerniles committed Jan 30, 2017
1 parent a9ec1c4 commit e32de12
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 46 deletions.
120 changes: 74 additions & 46 deletions lib/quick-pivot.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions test/logic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,21 @@ describe('accumulator', function() {

expect(accumulatedResults).to.equal(8);
});
it('average', function() {
var accumulatedResults = accumulator(data, 'age', 'average');

expect(accumulatedResults).to.equal(28.75);
});
it('min', function() {
var accumulatedResults = accumulator(data, 'age', 'min');

expect(accumulatedResults).to.equal(28);
});
it('max', function() {
var accumulatedResults = accumulator(data, 'age', 'max');

expect(accumulatedResults).to.equal(30);
});
});

it('should take an accumulation start value', function() {
Expand Down

0 comments on commit e32de12

Please sign in to comment.