SingleValueAccumulator.js 942 B

1234567891011121314151617181920212223242526272829303132
  1. var SingleValueAccumulator = module.exports = (function(){
  2. // Constructor
  3. /**
  4. * This isn't a finished accumulator, but rather a convenient base class
  5. * for others such as $first, $last, $max, $min, and similar. It just
  6. * provides a holder for a single Value, and the getter for that. The
  7. * holder is protected so derived classes can manipulate it.
  8. *
  9. * @class SingleValueAccumulator
  10. * @namespace munge.pipeline.accumulators
  11. * @module munge
  12. * @constructor
  13. **/
  14. var klass = module.exports = function AccumulatorSingleValue(){
  15. if(arguments.length > 1 ) throw new Error("expects a single value");
  16. base.call(this);
  17. }, Accumulator = require("./Accumulator"), base = Accumulator, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
  18. // DEPENDENCIES
  19. var Value = require("../Value");
  20. proto.getValue = function getValue(){
  21. return this.value;
  22. };
  23. return klass;
  24. })();