@turf/square 6.4.0 → 7.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/es/index.js +0 -0
- package/dist/js/index.js +7 -4
- package/index.d.ts +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
Takes a bounding box and calculates the minimum square bounding box that
|
|
8
8
|
would contain the input.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Parameters
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
* `bbox` **[BBox][1]** extent in \[west, south, east, north] order
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### Examples
|
|
15
15
|
|
|
16
16
|
```javascript
|
|
17
17
|
var bbox = [-20, -20, -15, 0];
|
package/dist/es/index.js
CHANGED
|
File without changes
|
package/dist/js/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var distance = require('@turf/distance');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var distance__default = /*#__PURE__*/_interopDefaultLegacy(distance);
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Takes a bounding box and calculates the minimum square bounding box that
|
|
@@ -24,8 +26,8 @@ function square(bbox) {
|
|
|
24
26
|
var east = bbox[2];
|
|
25
27
|
var north = bbox[3];
|
|
26
28
|
|
|
27
|
-
var horizontalDistance =
|
|
28
|
-
var verticalDistance =
|
|
29
|
+
var horizontalDistance = distance__default['default'](bbox.slice(0, 2), [east, south]);
|
|
30
|
+
var verticalDistance = distance__default['default'](bbox.slice(0, 2), [west, north]);
|
|
29
31
|
if (horizontalDistance >= verticalDistance) {
|
|
30
32
|
var verticalMidpoint = (south + north) / 2;
|
|
31
33
|
return [
|
|
@@ -46,3 +48,4 @@ function square(bbox) {
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
module.exports = square;
|
|
51
|
+
module.exports.default = square;
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/square",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.0",
|
|
4
4
|
"description": "turf square module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "git://github.com/Turfjs/turf.git"
|
|
14
14
|
},
|
|
15
|
+
"funding": "https://opencollective.com/turf",
|
|
15
16
|
"publishConfig": {
|
|
16
17
|
"access": "public"
|
|
17
18
|
},
|
|
@@ -50,8 +51,8 @@
|
|
|
50
51
|
"tape": "*"
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
|
53
|
-
"@turf/distance": "^
|
|
54
|
-
"@turf/helpers": "^
|
|
54
|
+
"@turf/distance": "^7.0.0-alpha.0",
|
|
55
|
+
"@turf/helpers": "^7.0.0-alpha.0"
|
|
55
56
|
},
|
|
56
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
|
|
57
58
|
}
|