(node, depth = 0)
| 86 | } |
| 87 | |
| 88 | function findIcloudAliasArray(node, depth = 0) { |
| 89 | if (!node || depth > 4) return null; |
| 90 | if (Array.isArray(node)) { |
| 91 | return node.some((item) => item && typeof item === 'object') ? node : null; |
| 92 | } |
| 93 | if (typeof node !== 'object') return null; |
| 94 | |
| 95 | const priorityKeys = ['hmeEmails', 'hmeEmailList', 'hmeList', 'hmes', 'aliases', 'items']; |
| 96 | for (const key of priorityKeys) { |
| 97 | if (Array.isArray(node[key])) return node[key]; |
| 98 | } |
| 99 | |
| 100 | for (const value of Object.values(node)) { |
| 101 | const nested = findIcloudAliasArray(value, depth + 1); |
| 102 | if (nested) return nested; |
| 103 | } |
| 104 | |
| 105 | return null; |
| 106 | } |
| 107 | |
| 108 | function normalizeIcloudAliasRecord(raw, options = {}) { |
| 109 | const usedEmails = toNormalizedEmailSet(options.usedEmails); |
no outgoing calls
no test coverage detected