Server IP : 150.95.80.236 / Your IP : 18.224.58.182 Web Server : Apache System : Linux host-150-95-80-236 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : social-telecare ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/pcu.in.th/uat.pcu.in.th/demo15/src/plugins/formvalidation/dist/amd/validators/ |
Upload File : |
define(["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function ismn() { return { validate: function (input) { if (input.value === '') { return { meta: null, valid: true, }; } var tpe; switch (true) { case /^M\d{9}$/.test(input.value): case /^M-\d{4}-\d{4}-\d{1}$/.test(input.value): case /^M\s\d{4}\s\d{4}\s\d{1}$/.test(input.value): tpe = 'ISMN10'; break; case /^9790\d{9}$/.test(input.value): case /^979-0-\d{4}-\d{4}-\d{1}$/.test(input.value): case /^979\s0\s\d{4}\s\d{4}\s\d{1}$/.test(input.value): tpe = 'ISMN13'; break; default: return { meta: null, valid: false, }; } var v = input.value; if ('ISMN10' === tpe) { v = "9790" + v.substr(1); } v = v.replace(/[^0-9]/gi, ''); var sum = 0; var length = v.length; var weight = [1, 3]; for (var i = 0; i < length - 1; i++) { sum += parseInt(v.charAt(i), 10) * weight[i % 2]; } sum = (10 - (sum % 10)) % 10; return { meta: { type: tpe, }, valid: "" + sum === v.charAt(length - 1), }; }, }; } exports.default = ismn; });