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

17 lines (12 loc) 411 B
import { toGrid } from '../../commons/table'; function captionFakedEvaluate(node) { var table = toGrid(node); var firstRow = table[0]; if (table.length <= 1 || firstRow.length <= 1 || node.rows.length <= 1) { return true; } return firstRow.reduce(function(out, curr, i) { return out || (curr !== firstRow[i + 1] && firstRow[i + 1] !== undefined); }, false); } export default captionFakedEvaluate;