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

20 lines (16 loc) 505 B
function nonEmptyIfPresentEvaluate(node, options, virtualNode) { // Check for 'default' names, which are given to reset and submit buttons let nodeName = virtualNode.props.nodeName; let type = (virtualNode.attr('type') || '').toLowerCase(); let label = virtualNode.attr('value'); if (label) { this.data({ messageKey: 'has-label' }); } if (nodeName === 'input' && ['submit', 'reset'].includes(type)) { return label === null; } return false; } export default nonEmptyIfPresentEvaluate;