<commit_before>import { Reactor } from './reactor.js';

/* Utility functions */

export function isCallable (fn) {
	return typeof fn === 'function' || Object.prototype.toString.call(fn) === '[object Function]';
}

export function funcOrNull (fn, name) {
	if ((fn === undefined) || (fn === null)) {
		return null;
	}
	if (isCallable(fn)) {
		return fn;
	}
	throw new Error(`Param ${name} must be a function`);
}

export function isThenable (obj) {
	return typeof obj === 'object' && !(obj instanceof Reactor) && 'then' in obj;
}<commit_msg>Added undef/null check to isThenable()<commit_after>import { Reactor } from './reactor.js';

/* Utility functions */

export function isCallable (fn) {
	return typeof fn === 'function' || Object.prototype.toString.call(fn) === '[object Function]';
}

export function funcOrNull (fn, name) {
	if ((fn === undefined) || (fn === null)) {
		return null;
	}
	if (isCallable(fn)) {
		return fn;
	}
	throw new Error(`Param ${name} must be a function`);
}

export function isThenable (obj) {
	return obj !== undefined && obj !== null && typeof obj === 'object' && !(obj instanceof Reactor) && 'then' in obj;
}
{'fraction_non_alphanumeric': 0.1780701754385965, 'fraction_numerical': 0.0, 'mean_word_length': 4.331775700934579, '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': '5470480', 'n_tokens_mistral': 371, 'n_tokens_neox': 366, 'n_words': 118}