<commit_before>var DEFAULT_ARGS = [];

A.debounce = function(fn, delay, context, args) {
	var id;

	delay = delay || 0;

	args = args ? A.Array(args) : DEFAULT_ARGS;

	var clearFn = function() {
		clearInterval(id);

		id = null;
	};

	var base = function() {
		clearFn();

		return fn.apply(context, args || DEFAULT_ARGS);
	};

	var delayFn = function(delayTime, newArgs, newContext, newFn) {
		wrapped.cancel();

		delayTime = delayTime || delay;

		fn = newFn || fn;
		context = newContext || context;

		args = newArgs ? A.Array(newArgs) : args;

		if (delayTime > 0) {
			id = setInterval(base, delayTime);
		}
		else {
			return base();
		}
	};

	var cancelFn = function() {
		if (id) {
			clearFn();
		}
	};

	var wrapped = function() {
		return wrapped.delay(delay, arguments, context || this);
	};

	wrapped.cancel = cancelFn;
	wrapped.delay = delayFn;

	return wrapped;
};<commit_msg>AUI-362 - Fixing default args so that they're included in call to wrapped function<commit_after>var Lang = A.Lang;

var DEFAULT_ARGS = [];

A.debounce = function(fn, delay, context, args) {
	var id;

	delay = delay || 0;

	args = !Lang.isUndefined(args) ? A.Array(args) : DEFAULT_ARGS;

	var clearFn = function() {
		clearInterval(id);

		id = null;
	};

	var base = function() {
		clearFn();

		return fn.apply(context, args || DEFAULT_ARGS);
	};

	var delayFn = function(delayTime, newArgs, newContext, newFn) {
		wrapped.cancel();

		delayTime = delayTime || delay;

		fn = newFn || fn;
		context = newContext || context;

		args = !Lang.isUndefined(newArgs) ? A.Array(newArgs) : args;

		if (delayTime > 0) {
			id = setInterval(base, delayTime);
		}
		else {
			return base();
		}
	};

	var cancelFn = function() {
		if (id) {
			clearFn();
		}
	};

	var wrapped = function() {
		var currentArgs = arguments.length ? arguments : args;

		return wrapped.delay(delay, currentArgs, context || this);
	};

	wrapped.cancel = cancelFn;
	wrapped.delay = delayFn;

	return wrapped;
};
{'fraction_non_alphanumeric': 0.14835443037974683, 'fraction_numerical': 0.0035443037974683543, 'mean_word_length': 3.4107142857142856, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3086706', 'n_tokens_mistral': 766, 'n_tokens_neox': 680, 'n_words': 178}