UNPKG

react-selectable

Version:

Allows individual or group selection of items using the mouse.

18 lines (14 loc) 357 B
const isNodeIn = (node, predicate) => { if (typeof predicate !== 'function') { throw new Error('isNodeIn second parameter must be a function'); } let currentNode = node; while (currentNode) { if (predicate(currentNode)) { return true; } currentNode = currentNode.parentNode; } return false; }; export default isNodeIn;