export default function isEventWithinNode(event, node) {
  if (!event || !node) {
    return false
  }

  if (typeof event.composedPath === 'function') {
    return event.composedPath().includes(node)
  }

  return node.contains(event.target)
}