mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-28 07:51:05 +00:00
19 lines
493 B
JavaScript
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
|