UNPKG

yh-validator

Version:

A lightweight form validation library with modular functions

1 lines 293 B
import {a}from'./chunk-QJYIPWK4.mjs';function f(l){if(a(l,"Card number"))return false;let e=l.replace(/[\s-]/g,"");if(e.length<13||e.length>19)return false;let i=0,n=false;for(let r=e.length-1;r>=0;r--){let t=parseInt(e[r],10);n&&(t*=2,t>9&&(t-=9)),i+=t,n=!n;}return i%10===0}export{f as a};