src/set-core.js
function(operator, a, b, aOptions, bOptions, evaluateOptions) {
		aOptions = aOptions || {};
		bOptions = bOptions || {};
		evaluateOptions = assign({
			evaluateWhere: operator,
			evaluatePaginate: operator,
			evaluateOrder: operator,

			shouldEvaluatePaginate: function(aClauseProps, bClauseProps) {
				return aClauseProps.enabled.paginate || bClauseProps.enabled.paginate;
			},
			shouldEvaluateOrder: function(aClauseProps, bClauseProps) {
				return aClauseProps.enabled.order && compare.equal(aClauseProps.order, bClauseProps.order, undefined, undefined, undefined,{},{});
			}
			/* aClauseProps.enabled.order || bClauseProps.enabled.order */
		}, evaluateOptions||{});

		var aClauseProps = this.getClauseProperties(a, aOptions),
			bClauseProps = this.getClauseProperties(b, bOptions),
			set = {},
			useSet;

		var result = evaluateOptions.evaluateWhere(aClauseProps.where, bClauseProps.where,
			undefined, undefined, undefined, this.clauses.where, {});

		useSet = this.updateSet(set, "where", result, useSet);

		// if success, and either has paginate props
		if(result && evaluateOptions.shouldEvaluatePaginate(aClauseProps,bClauseProps) ) {

			// if they have an order, it has to be true for paginate to be valid
			// this isn't true if a < b, a is paginated, and b is not.
			if( evaluateOptions.shouldEvaluateOrder(aClauseProps,bClauseProps)) {
				result = evaluateOptions.evaluateOrder(aClauseProps.order, bClauseProps.order, undefined,
					undefined, undefined, {}, {});

				useSet = this.updateSet(set, "order", result, useSet);
			}

			if(result) {
				result = evaluateOptions.evaluatePaginate(aClauseProps.paginate, bClauseProps.paginate,
					undefined, undefined, undefined, this.clauses.paginate, {});

				useSet = this.updateSet(set, "paginate", result, useSet);
			}
		}
		// if orders are the same keep order!
		else if( result && evaluateOptions.shouldEvaluateOrder(aClauseProps,bClauseProps) ) {

			result = operator(aClauseProps.order, bClauseProps.order, undefined,
				undefined, undefined, {}, {});

			useSet = this.updateSet(set, "order", result, useSet);
		}

		// not checking order here makes it mean that different orders represent the same set?

		return result && useSet ? set : result;
	}
function(operator, a, b, aOptions, bOptions, evaluateOptions) {
		aOptions = aOptions || {};
		bOptions = bOptions || {};
		evaluateOptions = assign({
			evaluateWhere: operator,
			evaluatePaginate: operator,
			evaluateOrder: operator,

			shouldEvaluatePaginate: function(aClauseProps, bClauseProps) {
				return aClauseProps.enabled.paginate || bClauseProps.enabled.paginate;
			},
			shouldEvaluateOrder: function(aClauseProps, bClauseProps) {
				return aClauseProps.enabled.order && compare.equal(aClauseProps.order, bClauseProps.order, undefined, undefined, undefined,{},{});
			}
			/* aClauseProps.enabled.order || bClauseProps.enabled.order */
		}, evaluateOptions||{});

		var aClauseProps = this.getClauseProperties(a, aOptions),
			bClauseProps = this.getClauseProperties(b, bOptions),
			set = {},
			useSet;

		var result = evaluateOptions.evaluateWhere(aClauseProps.where, bClauseProps.where,
			undefined, undefined, undefined, this.clauses.where, {});

		useSet = this.updateSet(set, "where", result, useSet);

		// if success, and either has paginate props
		if(result && evaluateOptions.shouldEvaluatePaginate(aClauseProps,bClauseProps) ) {

			// if they have an order, it has to be true for paginate to be valid
			// this isn't true if a < b, a is paginated, and b is not.
			if( evaluateOptions.shouldEvaluateOrder(aClauseProps,bClauseProps)) {
				result = evaluateOptions.evaluateOrder(aClauseProps.order, bClauseProps.order, undefined,
					undefined, undefined, {}, {});

				useSet = this.updateSet(set, "order", result, useSet);
			}

			if(result) {
				result = evaluateOptions.evaluatePaginate(aClauseProps.paginate, bClauseProps.paginate,
					undefined, undefined, undefined, this.clauses.paginate, {});

				useSet = this.updateSet(set, "paginate", result, useSet);
			}
		}
		// if orders are the same keep order!
		else if( result && evaluateOptions.shouldEvaluateOrder(aClauseProps,bClauseProps) ) {

			result = operator(aClauseProps.order, bClauseProps.order, undefined,
				undefined, undefined, {}, {});

			useSet = this.updateSet(set, "order", result, useSet);
		}

		// not checking order here makes it mean that different orders represent the same set?

		return result && useSet ? set : result;
	}
function ( operator , a , b , aOptions , bOptions , evaluateOptions ) { aOptions = aOptions || { } ; bOptions = bOptions || { } ; evaluateOptions = assign ( { evaluateWhere : operator , evaluatePaginate : operator , evaluateOrder : operator , shouldEvaluatePaginate : function ( aClauseProps , bClauseProps ) { return aClauseProps . enabled . paginate || bClauseProps . enabled . paginate ; } , shouldEvaluateOrder : function ( aClauseProps , bClauseProps ) { return aClauseProps . enabled . order && compare . equal ( aClauseProps . order , bClauseProps . order , undefined , undefined , undefined , { } , { } ) ; } /* aClauseProps.enabled.order || bClauseProps.enabled.order */ } , evaluateOptions || { } ) ; var aClauseProps = this . getClauseProperties ( a , aOptions ) , bClauseProps = this . getClauseProperties ( b , bOptions ) , set = { } , useSet ; var result = evaluateOptions . evaluateWhere ( aClauseProps . where , bClauseProps . where , undefined , undefined , undefined , this . clauses . where , { } ) ; useSet = this . updateSet ( set , "where" , result , useSet ) ; // if success, and either has paginate props if ( result && evaluateOptions . shouldEvaluatePaginate ( aClauseProps , bClauseProps ) ) { // if they have an order, it has to be true for paginate to be valid // this isn't true if a < b, a is paginated, and b is not. if ( evaluateOptions . shouldEvaluateOrder ( aClauseProps , bClauseProps ) ) { result = evaluateOptions . evaluateOrder ( aClauseProps . order , bClauseProps . order , undefined , undefined , undefined , { } , { } ) ; useSet = this . updateSet ( set , "order" , result , useSet ) ; } if ( result ) { result = evaluateOptions . evaluatePaginate ( aClauseProps . paginate , bClauseProps . paginate , undefined , undefined , undefined , this . clauses . paginate , { } ) ; useSet = this . updateSet ( set , "paginate" , result , useSet ) ; } } // if orders are the same keep order! else if ( result && evaluateOptions . shouldEvaluateOrder ( aClauseProps , bClauseProps ) ) { result = operator ( aClauseProps . order , bClauseProps . order , undefined , undefined , undefined , { } , { } ) ; useSet = this . updateSet ( set , "order" , result , useSet ) ; } // not checking order here makes it mean that different orders represent the same set? return result && useSet ? set : result ; }
calls the operator method on different parts of the set.
calls the operator method on different parts of the set .