UNPKG

extra-dom

Version:
18 lines 608 B
import { assert } from '@blackglory/errors'; export function nextSibling(node, distance = 1) { assert(Number.isInteger(distance), 'parameter distance must be an integer'); assert(distance >= 1, 'parameter distance must be greater than or equal to 1'); return _nextSibling(node, distance); } function _nextSibling(node, distance) { const currentNode = node.nextSibling; if (!currentNode) return undefined; if (distance === 1) { return currentNode; } else { return _nextSibling(currentNode, distance - 1); } } //# sourceMappingURL=next-sibling.js.map