/**
 * Detects if only the primary button has been clicked in mouse events.
 * @param {MouseEvent} event
 * @return {boolean}
 */
module.exports = function isPrimaryClick (event) {
	return (
		!event.altKey &&
		!event.ctrlKey &&
		!event.metaKey &&
		!event.shiftKey
	) && (
		('button' in event && event.button === 0) ||
		('buttons' in event && event.buttons === 1)
	);
};

/**
 * Detects if only the primary button has been clicked in mouse events.
 * @param {MouseEvent} e Event instance (or Event-like, i.e. `SyntheticEvent`)
 * @return {Boolean}
 */
module.exports = function isPrimaryClick (e) {
	return !(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) && (
		('button' in e && e.button === 0) ||
		('buttons' in e && e.buttons === 1)
	);
};

Simplify code and enhance comments
Simplify code and enhance comments
