(pages = [])
| 163 | * @returns {Array<object>} |
| 164 | */ |
| 165 | export const applyNumberFormulasToPages = (pages = []) => { |
| 166 | // Guard: if not an array or empty, just return as-is |
| 167 | if (!Array.isArray(pages) || pages.length === 0) { |
| 168 | return pages; |
| 169 | } |
| 170 | |
| 171 | // Clone pages and each widget.options so we do not mutate caller's data. |
| 172 | // (Shallow clone is sufficient for our current usage since we only touch `options`.) |
| 173 | const clonedPages = pages.map((page) => ({ |
| 174 | ...page, |
| 175 | pos: (page?.pos || []).map((widget) => ({ |
| 176 | ...widget, |
| 177 | options: { ...widget.options } |
| 178 | })) |
| 179 | })); |
| 180 | |
| 181 | // Return the cloned, updated pages |
| 182 | return clonedPages; |
| 183 | }; |
| 184 | |
| 185 | export const getInitials = (name) => { |
| 186 | if (!name) return ""; |
no outgoing calls
no test coverage detected