UNPKG

@modular-forms/solid

Version:

The modular and type-safe form library for SolidJS

21 lines (20 loc) 657 B
import { untrack } from 'solid-js'; import { removeInvalidNames } from './removeInvalidNames'; /** * Returns a list with the names of all field arrays. * * @param form The form of the field arrays. * @param shouldValid Whether to be valid. * * @returns All field array names of the form. */ export function getFieldArrayNames(form, shouldValid = true) { // Get name of every field array const fieldArrayNames = [...untrack(form.internal.fieldArrayNames.get)]; // Remove invalid field array names if (shouldValid) { removeInvalidNames(form, fieldArrayNames); } // Return field array names return fieldArrayNames; }