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

29 lines (22 loc) 643 B
import { labelVirtual, accessibleText, sanitize } from '../../commons/text'; import { idrefs } from '../../commons/dom'; function helpSameAsLabelEvaluate(node, options, virtualNode) { var labelText = labelVirtual(virtualNode), check = node.getAttribute('title'); if (!labelText) { return false; } if (!check) { check = ''; if (node.getAttribute('aria-describedby')) { var ref = idrefs(node, 'aria-describedby'); check = ref .map(function(thing) { return thing ? accessibleText(thing) : ''; }) .join(''); } } return sanitize(check) === sanitize(labelText); } export default helpSameAsLabelEvaluate;