{"version":3,"file":"insert-path.cjs","names":["getPath","setPath"],"sources":["../../src/paths/insert-path.ts"],"sourcesContent":["import { getPath } from './get-path';\nimport { setPath } from './set-path';\n\nexport function insertPath<T>(path: unknown, value: unknown, index: number | undefined, values: T) {\n  const currentValue = getPath(path, values);\n\n  if (!Array.isArray(currentValue)) {\n    return values;\n  }\n\n  const cloned = [...currentValue];\n  cloned.splice(typeof index === 'number' ? index : cloned.length, 0, value);\n\n  return setPath(path, cloned, values);\n}\n"],"mappings":";;;;AAGA,SAAgB,WAAc,MAAe,OAAgB,OAA2B,QAAW;CACjG,MAAM,eAAeA,iBAAAA,QAAQ,MAAM,MAAM;CAEzC,IAAI,CAAC,MAAM,QAAQ,YAAY,GAC7B,OAAO;CAGT,MAAM,SAAS,CAAC,GAAG,YAAY;CAC/B,OAAO,OAAO,OAAO,UAAU,WAAW,QAAQ,OAAO,QAAQ,GAAG,KAAK;CAEzE,OAAOC,iBAAAA,QAAQ,MAAM,QAAQ,MAAM;AACrC"}