SingleValueAccumulator.js 956 B

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