@mantine/form
Version:
Mantine form management library
17 lines (16 loc) • 611 B
JavaScript
"use client";
const require_get_path = require("./get-path.cjs");
const require_set_path = require("./set-path.cjs");
//#region packages/@mantine/form/src/paths/reorder-path.ts
function reorderPath(path, { from, to }, values) {
const currentValue = require_get_path.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 require_set_path.setPath(path, cloned, values);
}
//#endregion
exports.reorderPath = reorderPath;
//# sourceMappingURL=reorder-path.cjs.map