I know that title is non very espressive for understand!
So first Hello everyone and thanks for accept me to this group...
I want know if is possible implement to js cut a function for join all path with one line ... so ... one entry that passing all paths and return to begin

so ... the function need to find first path closest to 0
<path d="M10,10 L10,100 L100,100 L100,10 Z />
<path d="M20,20 L20,90 L90,90 L90,20 Z" />
<path d="M120,120 L120,200 L200,200 L200,120 Z" />
so ... first path in this case ...
after ... find path closest with this path ...
and join two path with closest pointers
<path d="M0,0 10,10 L10,100 L100,100 L100,10 L10,10 L20,20 L90,20 L90,90 L20,90 L20,20 L10,10Z" />
<path d="M120,120 L120,200 L200,200 L200,120 Z" />
after find closest path with path recent create ... and join in closest point
<path d="M0,0 10,10 L10,100 L100,100 L120,120 L120,200 L200,200 L200,120 L120,120 L100,100 L100,10 L10,10 L20,20 L90,20 L90,90 L20,90 L20,20 L10,10Z" />
this is useful for create code for foam cutters ... or in alternative ... guide me for a forum or another way to solve this problem ... because foam cutters cnc begins popular ... but principal problem is with create a big closest path ... thanks in advance for a eventually response