{"size": 795, "ext": "js", "max_stars_repo_path": "src/utils.js", "max_stars_repo_name": "Cap32/react-pan-responder-view", "max_stars_repo_stars_event_min_datetime": "2018-07-13T10:49:18.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-01T00:53:19.000Z", "max_issues_repo_path": "src/utils.js", "max_issues_repo_name": "Cap32/react-pan-responder-view", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/utils.js", "max_forks_repo_name": "Cap32/react-pan-responder-view", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.3846153846, "max_line_length": 68, "alphanum_fraction": 0.7094339623}
import passiveEvents from 'detect-passive-events';

export function isFunction(target) {
	return typeof target === 'function';
}

export function isObject(target) {
	return typeof target === 'object';
}

export function noop() {}

export function includes(arr, item) {
	return ~arr.indexOf(item);
}

export const supportPassive = passiveEvents.hasSupport;

export function createEventOptions(
	passive = false, // maybe, we should use `passive = true` sometimes
) {
	/* istanbul ignore else */
	if (!supportPassive) return true;
	/* istanbul ignore next */
	return { capture: true, passive };
}

export function getEventNodes(event) {
	if (event.path) return event.path;

	const pathArr = [];
	let el = event.target;
	while (el) {
		pathArr.push(el);
		el = el.parentNode;
	}
	return pathArr;
}
