/**
 * Stop `event` when `condition` is true
 * @param {Event} event
 * @param {boolean} condition
 * @returns {false|null}
 */
export default function stopEvent (event, condition = true) {
  if (condition) {
    if (event.cancelable) {
      event.preventDefault();
    }
    event.stopPropagation();
    return false;
  }
  return undefined;
}
