<commit_before>

export function destroyPlugin({ instance={}, pluginApi }, partial=false) {
	pluginApi && pluginApi.destroy(partial);
	destroy(instance, partial);
}


export function destroy(instance, partial=false) {
	if (typeof instance.destroy==='function') {
		instance.destroy(partial);

	} else if (typeof instance.destroy==='object') {
		instance.destroy.forEach(destroy => destroy(partial));

	} else if (typeof instance==='function') {
		instance(partial);
	}
}<commit_msg>Refactor destroy to check instance variable<commit_after>

export function destroyPlugin({ instance={}, pluginApi }, partial=false) {
	pluginApi && pluginApi.destroy(partial);
	destroy(instance, partial);
}


export function destroy(instance, partial=false) {
	if (instance) {
		if (typeof instance.destroy==='function') {
			instance.destroy(partial);

		} else if (typeof instance.destroy==='object') {
			instance.destroy.forEach(destroy => destroy(partial));

		} else if (typeof instance==='function') {
			instance(partial);
		}
	}
}
{'fraction_non_alphanumeric': 0.15279138099902057, 'fraction_numerical': 0.0, 'mean_word_length': 5.859060402684563, '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': '3665322', 'n_tokens_mistral': 306, 'n_tokens_neox': 285, 'n_words': 67}