(pointList)
| 344 | } |
| 345 | |
| 346 | export function formatCoord(pointList) { |
| 347 | let xList = []; |
| 348 | let yList = []; |
| 349 | if (isObject(pointList) && pointList.type === 'FeatureCollection') { |
| 350 | pointList.features.forEach((feature) => { |
| 351 | const coord = feature.geometry.coordinates; |
| 352 | xList.push(coord[0]); |
| 353 | yList.push(coord[1]) |
| 354 | }); |
| 355 | } else if (Array.isArray(pointList)) { |
| 356 | pointList.forEach((item) => { |
| 357 | if (item.type === 'Feature') { |
| 358 | const coord = item.geometry.coordinates; |
| 359 | xList.push(coord[0]); |
| 360 | yList.push(coord[1]) |
| 361 | } else if (Array.isArray(item)) { |
| 362 | xList.push(item[0]); |
| 363 | yList.push(item[1]) |
| 364 | } else if (isObject(item)) { |
| 365 | xList.push(item.x); |
| 366 | yList.push(item.y) |
| 367 | } |
| 368 | }); |
| 369 | } |
| 370 | return { |
| 371 | xList, |
| 372 | yList |
| 373 | } |
| 374 | } |
no test coverage detected