SingleValueAccumulator.js 851 B

12345678910111213141516171819202122232425262728
  1. var AccumulatorSingleValue = 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. var klass = module.exports = function AccumulatorSingleValue(value){
  10. if(arguments.length > 1 ) throw new Error("expects a single value");
  11. this.value = value;
  12. base.call(this);
  13. }, Accumulator = require("./Accumulator"), base = Accumulator, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
  14. // DEPENDENCIES
  15. var Value = require("../Value");
  16. proto.getValue = function getValue(){
  17. return this.value;
  18. };
  19. return klass;
  20. })();