|
@@ -1,6 +1,8 @@
|
|
var SubtractExpression = module.exports = (function(){
|
|
var SubtractExpression = module.exports = (function(){
|
|
// CONSTRUCTOR
|
|
// CONSTRUCTOR
|
|
- /** A $subtract pipeline expression. @see evaluate **/
|
|
|
|
|
|
+ /**
|
|
|
|
+ * A $subtract pipeline expression. @see evaluate
|
|
|
|
+ **/
|
|
var klass = function SubtractExpression(){
|
|
var klass = function SubtractExpression(){
|
|
if(arguments.length !== 0) throw new Error("zero args expected");
|
|
if(arguments.length !== 0) throw new Error("zero args expected");
|
|
base.call(this);
|
|
base.call(this);
|
|
@@ -16,10 +18,12 @@ var Value = require("../Value");
|
|
|
|
|
|
proto.addOperand = function addOperand(expr) {
|
|
proto.addOperand = function addOperand(expr) {
|
|
this.checkArgLimit(2);
|
|
this.checkArgLimit(2);
|
|
- base.addOperand(expr);
|
|
|
|
|
|
+ base.prototype.addOperand.call(this, expr);
|
|
};
|
|
};
|
|
|
|
|
|
- /** Takes an array that contains a pair of numbers and subtracts the second from the first, returning their difference. **/
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Takes an array that contains a pair of numbers and subtracts the second from the first, returning their difference.
|
|
|
|
+ **/
|
|
proto.evaluate = function evaluate(doc) {
|
|
proto.evaluate = function evaluate(doc) {
|
|
this.checkArgCount(2);
|
|
this.checkArgCount(2);
|
|
var left = this.operands[0].evaluate(doc),
|
|
var left = this.operands[0].evaluate(doc),
|