PageSourceSearch

https://lophocvitinh.vn/trolybep/public/js/hercules/BarcodeValidator.js?v=1789186167

js lophocvitinh.vn collected 2026-09-24 11:41:47 UTC 471 bytes, 13 lines download raw bytes

1// ==========================================
2// 1. CLASS XỬ LÝ KIỂM TRA MÃ VẠCH (Validator)
3// ==========================================
4class BarcodeValidator {
5	static isValidEAN(code) {
6	  if (!/^(\d{8}|\d{13})$/.test(code)) return false;
7	  const digits = code.split('').map(Number);
8	  const check = digits.pop();
9	  let sum = 0;
10	  digits.reverse().forEach((d, i) => { sum += d * (i % 2 === 0 ? 3 : 1); });
11	  return (10 - (sum % 10)) % 10 === check;
12	}
13}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.