Есть файлы с структурой вида:
var info = {
"province_to_regions":{
"RU_36":{
"regions":[
"reg_02",
"reg_07"
],
"position":{
"y":471.66599,
"x":567.87701
}
}, ...
},
"provinces":{
"RU_36":{
"position":{
"y":475.66599,
"x":399.375
},
"neighbours":[
"YU_09",
"AL_01",
"YU_02",
"YU_04",
"YU_06"
],
"border":"m 404.038,478.686 -0.808,0.411 -0.825,0.886 -0.753,0.248 -0.412,-0.508 0.117,-0.76 -0.251,-0.622 -3.317,3.065 -0.375,1.602 0.131,1.41 -0.008,1.107 -0.276,0.549 0.211,0.652 -1.336,-1.445 -0.006,-0.709 -3.753,-5.738 0.241,-1.257 0.455,-0.256 0.35,-0.952 -0.48,-0.909 0.489,-2.372 1.321,-0.764 -0.267,-0.755 0.447,-1.209 1.471,-0.621 0.705,0.659 0.843,-0.749 -0.7,-0.713 -0.236,-0.865 2.96,0.883 0.322,1.088 3.146,3.518 0.926,-0.293 2.479,2.145 -0.199,0.792 -2.72,0.88 0.588,0.608 z",
"primary":true
},..
},
"borders":[
{
"path":"m 428.671,345.738 -10.316,0.048 -6.193,-0.643 -6.209,-1.439",
"neighbours":[
"RU_10",
"PL_03"
],
"id":"RU_10-PL_03"
},...
],
"cross_points":{
"NO_05-SW_05":{
"y":259.492,
"x":356.82101,
"dx":-3.83401,
"dy":-2.0
},...
}
};
все доступны по путю
/reg_01/maps.js
/reg_02/maps.js
...
/reg_n/maps.js
Как их собрать в один JS файл с сохранением структуры
var info = {
"province_to_regions":{
},
"provinces":{
},
"borders":[
],
"cross_points":{
}
};
и заменой одинаковых участков кода?(замена не критична, допускаеться повтор) .