<commit_before>/**
 * @class
 *
 * @param {L.larva.Undoable} undoable
 * @param {String} desc
 * @param {Function} doFn
 * @param {Function} undoFn
 */
L.larva.Command = L.Class.extend(
/** @lends L.larva.Command.prototype */
{

	statics: {
		APPLY: 1,
		UNAPPLY: 2
	},

	/**
	 * @type {L.larva.Command}
	 */
	next: null,
	/**
	 * @type {L.larva.Command}
	 */
	prev: null,

	initialize: function (undoable, desc, doFn, undoFn, args) {
		this._undoable = undoable;
		this._desc = desc;
		this._doFn = doFn;
		this._undoFn = undoFn;
		this._args = args;
	},

	apply: function () {
		try {
			if (!this._nextState || (this._nextState === L.larva.Command.APPLY)) {
				this._doFn.apply(this._undoable, this._args);
			}
		} finally {
			this._nextState = L.larva.Command.UNAPPLY;
		}
	},

	unapply: function () {
		try {
			if (!this._nextState || (this._nextState === L.larva.Command.UNAPPLY)) {
				this._undoFn.apply(this._undoable, this._args);
			}
		} finally {
			this._nextState = L.larva.Command.APPLY;
		}
	},
	/**
	 * @return {Number}
	 */
	nextState: function () {
		return this._nextState;
	}

});

/**
 * @param  {L.larva.Undoable} undoable
 * @param  {Function} doFn
 * @param  {Function} undoFn
 * @param  {Any[]} args
 * @return {L.larva.Command}
 */
L.larva.command = function (undoable, desc, doFn, undoFn, args) {
	return new L.larva.Command(undoable, desc, doFn, undoFn, args);
};<commit_msg>Fixed Security Bug in L.larva.Command<commit_after>/**
 * @class
 *
 * @param {L.larva.Undoable} undoable
 * @param {String} desc
 * @param {Function} doFn
 * @param {Function} undoFn
 */
L.larva.Command = L.Class.extend(
/** @lends L.larva.Command.prototype */
{

	statics: {
		APPLY: 1,
		UNAPPLY: 2
	},

	/**
	 * @type {L.larva.Command}
	 */
	next: null,
	/**
	 * @type {L.larva.Command}
	 */
	prev: null,

	initialize: function (undoable, desc, doFn, undoFn, args) {
		this._undoable = undoable;
		this._desc = desc;
		this._doFn = doFn;
		this._undoFn = undoFn;
		this._args = args;
	},

	apply: function () {
		if (!this._nextState || (this._nextState === L.larva.Command.APPLY)) {
			try {
				this._doFn.apply(this._undoable, this._args);
			} finally {
				this._nextState = L.larva.Command.UNAPPLY;
			}
		}
	},

	unapply: function () {
		if (!this._nextState || (this._nextState === L.larva.Command.UNAPPLY)) {
			try {
					this._undoFn.apply(this._undoable, this._args);
			} finally {
				this._nextState = L.larva.Command.APPLY;
			}
		}
	},
	/**
	 * @return {Number}
	 */
	nextState: function () {
		return this._nextState;
	}

});

/**
 * @param  {L.larva.Undoable} undoable
 * @param  {Function} doFn
 * @param  {Function} undoFn
 * @param  {Any[]} args
 * @return {L.larva.Command}
 */
L.larva.command = function (undoable, desc, doFn, undoFn, args) {
	return new L.larva.Command(undoable, desc, doFn, undoFn, args);
};
{'fraction_non_alphanumeric': 0.18054092026694765, 'fraction_numerical': 0.0014049877063575693, 'mean_word_length': 3.0802292263610314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7175140', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1121, 'n_words': 216}