UNPKG

@mantine/form

Version:

Mantine form management library

25 lines (24 loc) 830 B
"use client"; require("../_virtual/_rolldown/runtime.cjs"); const require_get_splitted_path = require("./get-splitted-path.cjs"); let klona_full = require("klona/full"); //#region packages/@mantine/form/src/paths/set-path.ts function setPath(path, value, values) { const splittedPath = require_get_splitted_path.getSplittedPath(path); if (splittedPath.length === 0) return values; const cloned = (0, klona_full.klona)(values); if (splittedPath.length === 1) { cloned[splittedPath[0]] = value; return cloned; } let val = cloned[splittedPath[0]]; for (let i = 1; i < splittedPath.length - 1; i += 1) { if (val === void 0) return cloned; val = val[splittedPath[i]]; } val[splittedPath[splittedPath.length - 1]] = value; return cloned; } //#endregion exports.setPath = setPath; //# sourceMappingURL=set-path.cjs.map