UNPKG

luhn-generator

Version:

A generator of numbers that passes the validation of Luhn algorithm or Luhn formula, also known as the 'modulus 10' or 'mod 10' algorithm

21 lines (17 loc) 592 B
import { querySelectorAllFilter } from '../../core/utils'; import { isVisible } from '../../commons/dom'; function hasDescendant(node, options, virtualNode) { if (!options || !options.selector || typeof options.selector !== 'string') { throw new TypeError( 'has-descendant requires options.selector to be a string' ); } const matchingElms = querySelectorAllFilter( virtualNode, options.selector, vNode => isVisible(vNode.actualNode, true) ); this.relatedNodes(matchingElms.map(vNode => vNode.actualNode)); return matchingElms.length > 0; } export default hasDescendant;