tree from array of dot-separated strings
问题 I have an array of dot delimited strings which looks like the following data = [ 'Europe.UK.London.TrafalgarSq', 'Europe.UK.London.HydePark', 'Europe.UK.London.OxfordStreet', 'Europe.UK.London.City.Bank', 'Europe.France.Paris', 'Europe.France.Bordeaux'}, ] and I want to build the following tree of of nested objects. In case it matters, this is for a leaflet map where the Tree Layers Control is going to be used var tree = { label: 'Places', selectAllCheckbox: 'Un/select all', children: [ {