UNPKG

@mantine/form

Version:

Mantine form management library

20 lines (17 loc) 486 B
'use client'; import { getPath } from './get-path.mjs'; import { setPath } from './set-path.mjs'; 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); } export { replacePath }; //# sourceMappingURL=replace-path.mjs.map