(raw)
| 1661 | } |
| 1662 | |
| 1663 | function normalizeEfunCode(raw) { |
| 1664 | const compact = String(raw || "") |
| 1665 | .toUpperCase() |
| 1666 | .replace(/[^A-Z0-9]/g, ""); |
| 1667 | if (!compact.startsWith("UK")) { |
| 1668 | return String(raw || "").trim().toUpperCase().replace(/\s+/g, ""); |
| 1669 | } |
| 1670 | const body = compact.slice(2); |
| 1671 | if (body.length !== 25) { |
| 1672 | return String(raw || "").trim().toUpperCase().replace(/\s+/g, ""); |
| 1673 | } |
| 1674 | return `UK-${body.slice(0, 5)}-${body.slice(5, 10)}-${body.slice(10, 15)}-${body.slice(15, 20)}-${body.slice(20, 25)}`; |
| 1675 | } |
| 1676 | |
| 1677 | function safeJsonParse(raw, fallback) { |
| 1678 | try { |
no outgoing calls
no test coverage detected