MCPcopy Index your code
hub / github.com/OpenSignLabs/OpenSign / applyNumberFormulasToPages

Function applyNumberFormulasToPages

apps/OpenSign/src/utils/widgetUtils.js:165–183  ·  view source on GitHub ↗
(pages = [])

Source from the content-addressed store, hash-verified

163 * @returns {Array<object>}
164 */
165export 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
185export const getInitials = (name) => {
186 if (!name) return "";

Callers 2

handleWidgetdefaultdataFunction · 0.90
onChangeInputFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected