Suggest an algorithm to turn linear structures like this
[ {path: 'a', value: 'k'}, {path: 'b', value: 'l'}, {path: 'b.c', value: 'm'}, {path: 'd', value: 'n')]
list of path and value objects into a nested data-structure like this:
{ elements: { a: {value: 'k'}, b: {value: 'l', elements: {c: {value: 'm'}}, d: {value: 'n'}}