<commit_before>/*!
 * V4Fire Client Core
 * https://github.com/V4Fire/Client
 *
 * Released under the MIT license
 * https://github.com/V4Fire/Client/blob/master/LICENSE
 */

/**
 * Returns a first adaptee which is acceptable
 * @param strategies
 */
export function getAdaptee<T extends {acceptable: boolean}>(strategies: T[]): CanUndef<T> {
	for (let i = 0; i < strategies.length; i++) {
		const
			strategy = strategies[i];

		if (strategy.acceptable) {
			return strategy;
		}
	}

	return undefined;
}

/**
 * Returns true if an element is in view
 * @param el
 * @param threshold
 */
export function isInView(el: Element, threshold: number = 1): boolean {
	if (!document.documentElement) {
		return false;
	}

	const {
		top,
		right,
		bottom,
		left,
		width,
		height
	} = el.getBoundingClientRect();
<commit_msg>:art: jsdoc<commit_after>/*!
 * V4Fire Client Core
 * https://github.com/V4Fire/Client
 *
 * Released under the MIT license
 * https://github.com/V4Fire/Client/blob/master/LICENSE
 */

/**
 * Returns a first adaptee which is acceptable
 * @param strategies
 */
export function getAdaptee<T extends {acceptable: boolean}>(strategies: T[]): CanUndef<T> {
	for (let i = 0; i < strategies.length; i++) {
		const
			strategy = strategies[i];

		if (strategy.acceptable) {
			return strategy;
		}
	}

	return undefined;
}

/**
 * Returns true if an element is in view
 *
 * @param el
 * @param [threshold]
 */
export function isInView(el: Element, threshold: number = 1): boolean {
	if (!document.documentElement) {
		return false;
	}

	const {
		top,
		right,
		bottom,
		left,
		width,
		height
	} = el.getBoundingClientRect();

{'fraction_non_alphanumeric': 0.13677811550151975, 'fraction_numerical': 0.0060790273556231, 'mean_word_length': 3.4972677595628414, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '6812926', 'n_tokens_mistral': 592, 'n_tokens_neox': 547, 'n_words': 153}