Spaces:
Runtime error
Runtime error
| const VENDOR_CODE_REGEX = /^([A-Z]{4})-DSS-(\d{2})-(\d{3})$/; | |
| function normalizeVendorCode(value) { | |
| return String(value || '').trim().toUpperCase(); | |
| } | |
| function parseVendorCode(value) { | |
| const normalized = normalizeVendorCode(value); | |
| const match = normalized.match(VENDOR_CODE_REGEX); | |
| if (!match) { | |
| return null; | |
| } | |
| return { | |
| normalized, | |
| name4: match[1], | |
| year: match[2], | |
| sequence: match[3] | |
| }; | |
| } | |
| module.exports = { | |
| VENDOR_CODE_REGEX, | |
| normalizeVendorCode, | |
| parseVendorCode | |
| }; | |