Acesse objetos e matrizes aninhados usando o caminho da string
//to get
const resolvePath = (object, path) => path.split('.').reduce((o, p) => o?.[p], object)
//to get, returning a default value if not found
const resolvePath = (object, path, defaultValue) => path.split('.').reduce((o, p) => ?.[p] ?? defaultValue, object)
//to set
const setPath = (object, path, value) => path.split('.').reduce((o,p,i) => o[p] = path.split('.').length === ++i ? value : o[p] || {}, object)
Dr. Vortex