Files
emaui/node_modules/@mantine/form/esm/paths/reorder-path.mjs
2026-05-29 15:23:46 +03:00

19 lines
493 B
JavaScript

'use client';
import { getPath } from './get-path.mjs';
import { setPath } from './set-path.mjs';
function reorderPath(path, { from, to }, values) {
const currentValue = getPath(path, values);
if (!Array.isArray(currentValue)) {
return values;
}
const cloned = [...currentValue];
const item = currentValue[from];
cloned.splice(from, 1);
cloned.splice(to, 0, item);
return setPath(path, cloned, values);
}
export { reorderPath };
//# sourceMappingURL=reorder-path.mjs.map