<commit_before>/*!
 * CouchDB-API
 * @author <NAME> <<EMAIL>>
 */

/** Module Dependencies */
var _ = require("underscore"),
	url = require("url");

/** @private */
function modifyUrl(oldUrl, newUrl) {
	urlObj = _.clone(oldUrl);

	if (!newUrl) {
		return urlObj;
	} else if (_.isString(newUrl)) {
		newUrl = url.parse(newUrl);
	}

	if (newUrl.pathname) {
		if (newUrl.replace) {
			urlObj.pathname = newUrl.pathname;
		} else {
			urlObj.pathname += newUrl.pathname;
		}
	}
	if (newUrl.query) {
		urlObj.query = urlObj.query || {};
		if (newUrl.replace) {
			urlObj.query = _.clone(newUrl.query);
		} else {
			_.extend(urlObj.query, newUrl.query);
		}
	}

	return urlObj;
}

/**
 * Pass along a request to the underlying Client object, using the current objects urlObj as the base
 * Returns `this` in order to be made chainable
 */
function req() {
	var args = _.toArray(arguments),
		method = args.shift().toLowerCase();

	if (args.length > 1) {
		args[0] = modifyUrl(this.urlObj, args[0]);
	} else {
		args.unshift(this.urlObj);
	}

	this.client[method].apply(this.client, args);

	return this;
}

/**
 * Enable debug mode for the client object (not very useful externally right now)
 *
 * @param {string} level  Outputs logs at and above the specified level (debug, info, warn, error)
 */
function debug(level) {
	this.client.log.level(level);
}

/**
 * Retrieve the string URL for the current object
 */
function url() {
	return url.format(this.urlObj);
}

/** More efficient mixin */
module.exports = (function () {
	return function () {
		this.req = req;
		this.debug = debug;
		this.url = url;
		return this;
	};
})();<commit_msg>correcting reference to url in mixin<commit_after>/*!
 * CouchDB-API
 * @author <NAME> <<EMAIL>>
 */

/** Module Dependencies */
var _ = require("underscore"),
	url = require("url");

/** @private */
function modifyUrl(oldUrl, newUrl) {
	urlObj = _.clone(oldUrl);

	if (!newUrl) {
		return urlObj;
	} else if (_.isString(newUrl)) {
		newUrl = url.parse(newUrl);
	}

	if (newUrl.pathname) {
		if (newUrl.replace) {
			urlObj.pathname = newUrl.pathname;
		} else {
			urlObj.pathname += newUrl.pathname;
		}
	}
	if (newUrl.query) {
		urlObj.query = urlObj.query || {};
		if (newUrl.replace) {
			urlObj.query = _.clone(newUrl.query);
		} else {
			_.extend(urlObj.query, newUrl.query);
		}
	}

	return urlObj;
}

/**
 * Pass along a request to the underlying Client object, using the current objects urlObj as the base
 * Returns `this` in order to be made chainable
 */
function req() {
	var args = _.toArray(arguments),
		method = args.shift().toLowerCase();

	if (args.length > 1) {
		args[0] = modifyUrl(this.urlObj, args[0]);
	} else {
		args.unshift(this.urlObj);
	}

	this.client[method].apply(this.client, args);

	return this;
}

/**
 * Enable debug mode for the client object (not very useful externally right now)
 *
 * @param {string} level  Outputs logs at and above the specified level (debug, info, warn, error)
 */
function debug(level) {
	this.client.log.level(level);
}

/**
 * Retrieve the string URL for the current object
 */
function getUrl() {
	return url.format(this.urlObj);
}

/** More efficient mixin */
module.exports = (function () {
	return function () {
		this.req = req;
		this.debug = debug;
		this.url = getUrl;
		return this;
	};
})();
{'fraction_non_alphanumeric': 0.1566374357423647, 'fraction_numerical': 0.0018143332325370426, 'mean_word_length': 3.494565217391304, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5646309', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1153, 'n_words': 305}