UNPKG

@mantine/form

Version:

Mantine form management library

16 lines (15 loc) 530 B
"use client"; import { getPath } from "./get-path.mjs"; import { setPath } from "./set-path.mjs"; //#region packages/@mantine/form/src/paths/replace-path.ts function replacePath(path, item, index, values) { const currentValue = getPath(path, values); if (!Array.isArray(currentValue)) return values; if (currentValue.length <= index) return values; const cloned = [...currentValue]; cloned[index] = item; return setPath(path, cloned, values); } //#endregion export { replacePath }; //# sourceMappingURL=replace-path.mjs.map