luhn function

LivrRule luhn(
  1. List<Object?> args,
  2. RuleContext context
)

luhn: the value must be at least 2 digits with a valid Luhn (mod 10) checksum. It is checked as it is: spaces and dashes are not removed. The output is the value as a string.

Implementation

LivrRule luhn(List<Object?> args, RuleContext context) {
  if (args.isNotEmpty) {
    throw const LivrSchemaException('Rule [luhn] takes no arguments');
  }
  return _luhn;
}