MCPcopy Create free account
hub / github.com/Lemoncode/fonk / formatFieldForArrayField

Function formatFieldForArrayField

src/helpers/helpers.ts:52–62  ·  view source on GitHub ↗
(fieldId: string, value)

Source from the content-addressed store, hash-verified

50): boolean => /\[.*\]/.test(fieldId) && !isFieldIdInSchema(fieldId, schema);
51
52export const formatFieldForArrayField = (fieldId: string, value) => {
53 const formattedValue = set({}, fieldId, value);
54 const keys = Boolean(fieldId) ? Object.keys(formattedValue) : [''];
55 const id = Array.isArray(keys) && keys.length > 0 ? keys[0] : '';
56 return {
57 id,
58 value: Array.isArray(formattedValue[id])
59 ? [...formattedValue[id]]
60 : formattedValue[id],
61 };
62};

Callers 2

FormValidationClass · 0.90
helpers.spec.tsFile · 0.90

Calls 1

setFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…