export const setPath = (src: any, path: string[], value: any) => { src = src || {}; if (path.length > 1) { const key = path.shift()!; src[key] = setPath(src[key], path, value); } else { src[path[0]] = value; } return src; };