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.