Created
June 25, 2020 12:25
-
-
Save PawelGIX/84d659406f2d0799e790ef1257eae861 to your computer and use it in GitHub Desktop.
walidacja numeru konta bankowego
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function NRBvalidatior(nrb) | |
{ | |
nrb = nrb.replace(/[^0-9]+/g,''); | |
var Wagi = new Array(1,10,3,30,9,90,27,76,81,34,49,5,50,15,53,45,62,38,89,17, | |
73,51,25,56,75,71,31,19,93,57); | |
if(nrb.length == 26) { | |
nrb = nrb + "2521"; | |
nrb = nrb.substr(2) + nrb.substr(0,2); | |
var Z =0; | |
for (var i=0;i<30;i++) { | |
Z += nrb[29-i] * Wagi[i]; | |
} | |
if (Z % 97 == 1) { | |
return true; | |
}else{ | |
return false; | |
} | |
}else{ | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment