I"¥(function() { var ElfProef, root, zip; ElfProef = (function() { function ElfProef(input) { var ref; this.nrs = [2, 3, 4, 5, 6, 7, 8, 9].reverse(); ref = input.toString().match(/[0-9a-z]/gi).join("").toUpperCase().match(/([0-9]*)([A-Z]*)([0-9]*)/i), this.match = ref[0], this.nummer = ref[1], this.letter = ref[2], this.subnummer = ref[3]; } ElfProef.prototype.elfproef = function(a) { var j, len, reeks, som, x; this.nrs.push(a); som = 0; reeks = zip(this.nrs, this.nr); for (j = 0, len = reeks.length; j < len; j++) { x = reeks[j]; som += x[0] * x[1]; } return som % 11 === 0 && som > 0; }; ElfProef.prototype.validBsn = function() { this.nr = this.nummer.match(/./g); if (this.nr.length > 9) { return false; } while (this.nr.length < 9) { this.nr.unshift(0); } return this.elfproef(-1); }; ElfProef.prototype.validRekening = function() { var ref; this.nr = this.nummer.match(/./g); if ((ref = this.nr.length) !== 9 && ref !== 10) { return false; } if (this.nr.length === 10) { this.nrs.unshift(10); } return this.elfproef(1); }; ElfProef.prototype.validLoonheffingennummer = function() { var check; this.nr = this.nummer.match(/./g); check = true; if (!this.validBsn()) { check = false; } if (this.letter !== "L") { check = false; } if (!(this.subnummer && this.subnummer.length === 2)) { check = false; } if (!(this.subnummer && this.subnummer.match(/./g).reduce(function(a, b) { return parseInt(a) + parseInt(b) > 0; }))) { check = false; } return check; }; return ElfProef; })(); zip = function() { var arr, i, j, length, lengthArray, ref, results; lengthArray = (function() { var j, len, results; results = []; for (j = 0, len = arguments.length; j < len; j++) { arr = arguments[j]; results.push(arr.length); } return results; }).apply(this, arguments); length = Math.min.apply(Math, lengthArray); results = []; for (i = j = 0, ref = length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) { results.push((function() { var k, len, results1; results1 = []; for (k = 0, len = arguments.length; k < len; k++) { arr = arguments[k]; results1.push(arr[i]); } return results1; }).apply(this, arguments)); } return results; }; $(function() { $(document).on('blur', '.checkMyBsn', function() { var e; if (this.value) { e = new ElfProef(this.value); if (e.validBsn()) { $(".checkMyBsn").val(e.nummer); return $(".bsn_message").text("ok"); } else { return $(".bsn_message").text("geen geldig bsn-nummer"); } } }); $(document).on('blur', '.checkMyRekening', function() { var e; if (this.value) { e = new ElfProef(this.value); if (e.validRekening()) { $(".checkMyRekening").val(e.match); return $(".rekening_message").text("ok"); } else { return $(".rekening_message").text("geen geldig rekening-nummer"); } } }); return $(document).on('blur', '.checkMyLoonheffing', function() { var e; if (this.value) { e = new ElfProef(this.value); if (e.validLoonheffingennummer()) { $(".checkMyLoonheffing").val(e.match); return $(".loonheffing_message").text("ok"); } else { if (this.value) { return $(".loonheffing_message").text("geen geldig loonheffingen-nummer"); } } } }); }); root = typeof exports !== "undefined" && exports !== null ? exports : window; root.ElfProef = ElfProef; }).call(this); :ET