UNPKG

@modular-forms/react

Version:

The modular and type-safe form library for React

12 lines (11 loc) 331 B
import { getPathIndex } from '../utils'; /** * Returns a function that sorts field names by their array path index. * * @param name The name of the field array. * * @returns The sort function. */ export function sortArrayPathIndex(name) { return (pathA, pathB) => getPathIndex(name, pathA) - getPathIndex(name, pathB); }