3 ms·
I agree, this is the hairiest, least documented part of the API. CoffeeScript makes it easier to read than the corresponding Javascript construction but then ag
by nicolaskruchten 13y ago
I agree, this is the hairiest, least documented part of the API. CoffeeScript makes it easier to read than the corresponding Javascript construction but then again this might be CS encouraging things that wouldn't fly in JS for good reason :)
The pivot table needs an aggregator object per cell, so we need a factory-function to provide one (this is the right-most arrow).
That function needs to know which columns to use as the numerator and denominator, without these being passed in on every invocation, so I used a function-generator that closes over those two values.
The third, almost gratuitous layer of function calls allows one to parametrically generate this function-generator with different formatting options.