Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ac73720

Browse files
committed
Bump turf v6 to v7
1 parent 634293a commit ac73720

File tree

4 files changed

+58
-34
lines changed

4 files changed

+58
-34
lines changed

draftlogs/7116_change.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Update turf to v7 [[#7116](https://github.com/plotly/plotly.js/pull/7116)]
2+

package-lock.json

Lines changed: 47 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@
7171
"@plotly/d3-sankey": "0.7.2",
7272
"@plotly/d3-sankey-circular": "0.33.1",
7373
"@plotly/mapbox-gl": "1.13.4",
74-
"@turf/area": "^6.5.0",
75-
"@turf/bbox": "^6.5.0",
76-
"@turf/centroid": "^6.5.0",
74+
"@turf/area": "^7.1.0",
75+
"@turf/bbox": "^7.1.0",
76+
"@turf/centroid": "^7.1.0",
7777
"base64-arraybuffer": "^1.0.2",
7878
"canvas-fit": "^1.5.0",
7979
"color-alpha": "1.0.4",

src/lib/geo_location_utils.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
var d3 = require('@plotly/d3');
44
var countryRegex = require('country-regex');
5-
var turfArea = require('@turf/area');
6-
var turfCentroid = require('@turf/centroid');
7-
var turfBbox = require('@turf/bbox');
5+
var { area: turfArea } = require('@turf/area');
6+
var { centroid: turfCentroid } = require('@turf/centroid');
7+
var { bbox: turfBbox } = require('@turf/bbox');
88

99
var identity = require('./identity');
1010
var loggers = require('./loggers');
@@ -295,7 +295,7 @@ function findCentroid(feature) {
295295

296296
for(var i = 0; i < coords.length; i++) {
297297
var polyi = {type: 'Polygon', coordinates: coords[i]};
298-
var area = turfArea.default(polyi);
298+
var area = turfArea(polyi);
299299
if(area > maxArea) {
300300
maxArea = area;
301301
poly = polyi;
@@ -305,7 +305,7 @@ function findCentroid(feature) {
305305
poly = geometry;
306306
}
307307

308-
return turfCentroid.default(poly).geometry.coordinates;
308+
return turfCentroid(poly).geometry.coordinates;
309309
}
310310

311311
function fetchTraceGeoData(calcData) {
@@ -366,7 +366,7 @@ function fetchTraceGeoData(calcData) {
366366
// TODO `turf/bbox` gives wrong result when the input feature/geometry
367367
// crosses the anti-meridian. We should try to implement our own bbox logic.
368368
function computeBbox(d) {
369-
return turfBbox.default(d);
369+
return turfBbox(d);
370370
}
371371

372372
module.exports = {

0 commit comments

Comments
 (0)