lib/mutators.js
function _makeJoiner (type) {
	return function (clause, options) {
		if (isQueryizeObject(clause)) {
			if (typeof options !== 'object') throw new Error('You must define join options when joining against a queryize subquery.');

			options = Object.create(options);
			options.table = clause;
			clause = options;
		} else if (typeof clause === 'object') {
			if (isArray(clause)) throw new TypeError('Join clauses can only be strings or object definitions');
			if (!clause.table) throw new Error('You must define a table to join against');
		} else if (typeof options === 'object') {
			options = Object.create(options);
			options.table = clause;
			clause = options;
		}

		if (typeof clause === 'object') {
			clause.type = type;
		} else {
			clause = clause.search(joinTest) > -1 ? clause.replace(joinTest, type + ' JOIN ') : type + ' JOIN ' + clause;
		}

		this.join(clause);

		return this;
	};
}
function _makeJoiner (type) {
	return function (clause, options) {
		if (isQueryizeObject(clause)) {
			if (typeof options !== 'object') throw new Error('You must define join options when joining against a queryize subquery.');

			options = Object.create(options);
			options.table = clause;
			clause = options;
		} else if (typeof clause === 'object') {
			if (isArray(clause)) throw new TypeError('Join clauses can only be strings or object definitions');
			if (!clause.table) throw new Error('You must define a table to join against');
		} else if (typeof options === 'object') {
			options = Object.create(options);
			options.table = clause;
			clause = options;
		}

		if (typeof clause === 'object') {
			clause.type = type;
		} else {
			clause = clause.search(joinTest) > -1 ? clause.replace(joinTest, type + ' JOIN ') : type + ' JOIN ' + clause;
		}

		this.join(clause);

		return this;
	};
}
function _makeJoiner ( type ) { return function ( clause , options ) { if ( isQueryizeObject ( clause ) ) { if ( typeof options !== 'object' ) throw new Error ( 'You must define join options when joining against a queryize subquery.' ) ; options = Object . create ( options ) ; options . table = clause ; clause = options ; } else if ( typeof clause === 'object' ) { if ( isArray ( clause ) ) throw new TypeError ( 'Join clauses can only be strings or object definitions' ) ; if ( ! clause . table ) throw new Error ( 'You must define a table to join against' ) ; } else if ( typeof options === 'object' ) { options = Object . create ( options ) ; options . table = clause ; clause = options ; } if ( typeof clause === 'object' ) { clause . type = type ; } else { clause = clause . search ( joinTest ) > - 1 ? clause . replace ( joinTest , type + ' JOIN ' ) : type + ' JOIN ' + clause ; } this . join ( clause ) ; return this ; } ; }
Generates the closures for innerJoin, leftJoin and rightJoin
@private
@param  {string} type Join type
@return {function}
Generates the closures for innerJoin leftJoin and rightJoin