UNPKG

@mantine/form

Version:

Mantine form management library

1 lines 688 B
{"version":3,"file":"remove-path.mjs","names":[],"sources":["../../src/paths/remove-path.ts"],"sourcesContent":["import { getPath } from './get-path';\nimport { setPath } from './set-path';\n\nexport function removePath<T>(path: unknown, index: number, values: T) {\n const currentValue = getPath(path, values);\n\n if (!Array.isArray(currentValue)) {\n return values;\n }\n\n return setPath(\n path,\n currentValue.filter((_, itemIndex) => itemIndex !== index),\n values\n );\n}\n"],"mappings":";;;;AAGA,SAAgB,WAAc,MAAe,OAAe,QAAW;CACrE,MAAM,eAAe,QAAQ,MAAM,MAAM;CAEzC,IAAI,CAAC,MAAM,QAAQ,YAAY,GAC7B,OAAO;CAGT,OAAO,QACL,MACA,aAAa,QAAQ,GAAG,cAAc,cAAc,KAAK,GACzD,MACF;AACF"}