UNPKG

@modular-forms/react

Version:

The modular and type-safe form library for React

12 lines (11 loc) 301 B
/** * Returns the index of the path in the field array. * * @param name The name of the field array. * @param path The path to get the index from. * * @returns The field index in the array. */ export function getPathIndex(name, path) { return +path.replace(`${name}.`, '').split('.')[0]; }