test = function(){
let index = []
lineslines.features.forEach(function(r, idx){
let obj = r
obj.points = []
let set = new Set()
lineslines.features.forEach(function(ki,i){
if (ki.properties.name != r.properties.name){
let int = turf.lineIntersect(r, ki);
if (int.features.length > 0) {
let intString = `${ki.properties.name} and ${r.properties.name}`
if (!set.has(intString)){
set.add(intString)
int.features[0].properties = {}
int.features[0].properties.int1 = ki.properties.name
int.features[0].properties.int2 = r.properties.name
obj.points.push(int.features[0])
}}
}
})
obj.points.sort((a,b) => turf.distance(obj.points[0],a)-turf.distance(obj.points[0],b))
index.push(obj)
})
return index}();