@turf/square 7.2.0 → 7.3.1
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/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +10 -11
package/dist/cjs/index.cjs
CHANGED
|
@@ -25,9 +25,9 @@ function square(bbox) {
|
|
|
25
25
|
];
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
var
|
|
28
|
+
var index_default = square;
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
exports.default =
|
|
32
|
+
exports.default = index_default; exports.square = square;
|
|
33
33
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-square/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACAA,0CAAyB;AAiBzB,SAAS,MAAA,CAAO,IAAA,EAAkB;AAChC,EAAA,IAAI,KAAA,EAAO,IAAA,CAAK,CAAC,CAAA;AACjB,EAAA,IAAI,MAAA,EAAQ,IAAA,CAAK,CAAC,CAAA;AAClB,EAAA,IAAI,KAAA,EAAO,IAAA,CAAK,CAAC,CAAA;AACjB,EAAA,IAAI,MAAA,EAAQ,IAAA,CAAK,CAAC,CAAA;AAElB,EAAA,IAAI,mBAAA,EAAqB,gCAAA,IAAS,CAAK,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA,EAAG,CAAC,IAAA,EAAM,KAAK,CAAC,CAAA;AACjE,EAAA,IAAI,iBAAA,EAAmB,gCAAA,IAAS,CAAK,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA,EAAG,CAAC,IAAA,EAAM,KAAK,CAAC,CAAA;AAC/D,EAAA,GAAA,CAAI,mBAAA,GAAsB,gBAAA,EAAkB;AAC1C,IAAA,IAA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,GAAA,CAAI,mBAAA,GAAsB,gBAAA,EAAkB;AAC1C,IAAA,IAAI,iBAAA,EAAA,CAAoB,MAAA,EAAQ,KAAA,EAAA,EAAS,CAAA;AACzC,IAAA,OAAO;AAAA,MACL,IAAA;AAAA,MACA,iBAAA,EAAA,CAAoB,KAAA,EAAO,IAAA,EAAA,EAAQ,CAAA;AAAA,MACnC,IAAA;AAAA,MACA,iBAAA,EAAA,CAAoB,KAAA,EAAO,IAAA,EAAA,EAAQ;AAAA,IACrC,CAAA;AAAA,EACF,EAAA,KAAO;AACL,IAAA,IAAI,mBAAA,EAAA,CAAsB,KAAA,EAAO,IAAA,EAAA,EAAQ,CAAA;AACzC,IAAA,OAAO;AAAA,MACL,mBAAA,EAAA,CAAsB,MAAA,EAAQ,KAAA,EAAA,EAAS,CAAA;AAAA,MACvC,KAAA;AAAA,MACA,mBAAA,EAAA,CAAsB,MAAA,EAAQ,KAAA,EAAA,EAAS,CAAA;AAAA,MACvC;AAAA,IACF,CAAA;AAAA,EACF;AACF;AAGA,IAAO,cAAA,EAAQ,MAAA;ADjBf;AACE;AACA;AACF,yDAAC","file":"/home/runner/work/turf/turf/packages/turf-square/dist/cjs/index.cjs","sourcesContent":[null,"import { distance } from \"@turf/distance\";\nimport { BBox } from \"geojson\";\n\n/**\n * Takes a bounding box and calculates the minimum square bounding box that\n * would contain the input.\n *\n * @function\n * @param {BBox} bbox extent in [west, south, east, north] order\n * @returns {BBox} a square surrounding `bbox`\n * @example\n * const bbox = [-20, -20, -15, 0];\n * const squared = turf.square(bbox);\n *\n * //addToMap\n * const addToMap = [turf.bboxPolygon(bbox), turf.bboxPolygon(squared)]\n */\nfunction square(bbox: BBox): BBox {\n var west = bbox[0];\n var south = bbox[1];\n var east = bbox[2];\n var north = bbox[3];\n\n var horizontalDistance = distance(bbox.slice(0, 2), [east, south]);\n var verticalDistance = distance(bbox.slice(0, 2), [west, north]);\n if (horizontalDistance >= verticalDistance) {\n var verticalMidpoint = (south + north) / 2;\n return [\n west,\n verticalMidpoint - (east - west) / 2,\n east,\n verticalMidpoint + (east - west) / 2,\n ];\n } else {\n var horizontalMidpoint = (west + east) / 2;\n return [\n horizontalMidpoint - (north - south) / 2,\n south,\n horizontalMidpoint + (north - south) / 2,\n north,\n ];\n }\n}\n\nexport { square };\nexport default square;\n"]}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { distance } from \"@turf/distance\";\nimport { BBox } from \"geojson\";\n\n/**\n * Takes a bounding box and calculates the minimum square bounding box that\n * would contain the input.\n *\n * @function\n * @param {BBox} bbox extent in [west, south, east, north] order\n * @returns {BBox} a square surrounding `bbox`\n * @example\n * const bbox = [-20, -20, -15, 0];\n * const squared = turf.square(bbox);\n *\n * //addToMap\n * const addToMap = [turf.bboxPolygon(bbox), turf.bboxPolygon(squared)]\n */\nfunction square(bbox: BBox): BBox {\n var west = bbox[0];\n var south = bbox[1];\n var east = bbox[2];\n var north = bbox[3];\n\n var horizontalDistance = distance(bbox.slice(0, 2), [east, south]);\n var verticalDistance = distance(bbox.slice(0, 2), [west, north]);\n if (horizontalDistance >= verticalDistance) {\n var verticalMidpoint = (south + north) / 2;\n return [\n west,\n verticalMidpoint - (east - west) / 2,\n east,\n verticalMidpoint + (east - west) / 2,\n ];\n } else {\n var horizontalMidpoint = (west + east) / 2;\n return [\n horizontalMidpoint - (north - south) / 2,\n south,\n horizontalMidpoint + (north - south) / 2,\n north,\n ];\n }\n}\n\nexport { square };\nexport default square;\n"],"mappings":";AAAA,SAAS,gBAAgB;AAiBzB,SAAS,OAAO,MAAkB;AAChC,MAAI,OAAO,KAAK,CAAC;AACjB,MAAI,QAAQ,KAAK,CAAC;AAClB,MAAI,OAAO,KAAK,CAAC;AACjB,MAAI,QAAQ,KAAK,CAAC;AAElB,MAAI,qBAAqB,SAAS,KAAK,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC;AACjE,MAAI,mBAAmB,SAAS,KAAK,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC;AAC/D,MAAI,sBAAsB,kBAAkB;AAC1C,QAAI,oBAAoB,QAAQ,SAAS;AACzC,WAAO;AAAA,MACL;AAAA,MACA,oBAAoB,OAAO,QAAQ;AAAA,MACnC;AAAA,MACA,oBAAoB,OAAO,QAAQ;AAAA,IACrC;AAAA,EACF,OAAO;AACL,QAAI,sBAAsB,OAAO,QAAQ;AACzC,WAAO;AAAA,MACL,sBAAsB,QAAQ,SAAS;AAAA,MACvC;AAAA,MACA,sBAAsB,QAAQ,SAAS;AAAA,MACvC;AAAA,IACF;AAAA,EACF;AACF;AAGA,IAAO,
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { distance } from \"@turf/distance\";\nimport { BBox } from \"geojson\";\n\n/**\n * Takes a bounding box and calculates the minimum square bounding box that\n * would contain the input.\n *\n * @function\n * @param {BBox} bbox extent in [west, south, east, north] order\n * @returns {BBox} a square surrounding `bbox`\n * @example\n * const bbox = [-20, -20, -15, 0];\n * const squared = turf.square(bbox);\n *\n * //addToMap\n * const addToMap = [turf.bboxPolygon(bbox), turf.bboxPolygon(squared)]\n */\nfunction square(bbox: BBox): BBox {\n var west = bbox[0];\n var south = bbox[1];\n var east = bbox[2];\n var north = bbox[3];\n\n var horizontalDistance = distance(bbox.slice(0, 2), [east, south]);\n var verticalDistance = distance(bbox.slice(0, 2), [west, north]);\n if (horizontalDistance >= verticalDistance) {\n var verticalMidpoint = (south + north) / 2;\n return [\n west,\n verticalMidpoint - (east - west) / 2,\n east,\n verticalMidpoint + (east - west) / 2,\n ];\n } else {\n var horizontalMidpoint = (west + east) / 2;\n return [\n horizontalMidpoint - (north - south) / 2,\n south,\n horizontalMidpoint + (north - south) / 2,\n north,\n ];\n }\n}\n\nexport { square };\nexport default square;\n"],"mappings":";AAAA,SAAS,gBAAgB;AAiBzB,SAAS,OAAO,MAAkB;AAChC,MAAI,OAAO,KAAK,CAAC;AACjB,MAAI,QAAQ,KAAK,CAAC;AAClB,MAAI,OAAO,KAAK,CAAC;AACjB,MAAI,QAAQ,KAAK,CAAC;AAElB,MAAI,qBAAqB,SAAS,KAAK,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC;AACjE,MAAI,mBAAmB,SAAS,KAAK,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC;AAC/D,MAAI,sBAAsB,kBAAkB;AAC1C,QAAI,oBAAoB,QAAQ,SAAS;AACzC,WAAO;AAAA,MACL;AAAA,MACA,oBAAoB,OAAO,QAAQ;AAAA,MACnC;AAAA,MACA,oBAAoB,OAAO,QAAQ;AAAA,IACrC;AAAA,EACF,OAAO;AACL,QAAI,sBAAsB,OAAO,QAAQ;AACzC,WAAO;AAAA,MACL,sBAAsB,QAAQ,SAAS;AAAA,MACvC;AAAA,MACA,sBAAsB,QAAQ,SAAS;AAAA,MACvC;AAAA,IACF;AAAA,EACF;AACF;AAGA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/square",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.3.1",
|
|
4
|
+
"description": "Takes a bounding box and calculates the minimum square bounding box that would contain the input.",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bugs": {
|
|
@@ -47,24 +47,23 @@
|
|
|
47
47
|
"bench": "tsx bench.ts",
|
|
48
48
|
"build": "tsup --config ../../tsup.config.ts",
|
|
49
49
|
"docs": "tsx ../../scripts/generate-readmes.ts",
|
|
50
|
-
"test": "
|
|
50
|
+
"test": "pnpm run /test:.*/",
|
|
51
51
|
"test:tape": "tsx test.ts"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/benchmark": "^2.1.5",
|
|
55
|
-
"@types/tape": "^
|
|
55
|
+
"@types/tape": "^5.8.1",
|
|
56
56
|
"benchmark": "^2.1.4",
|
|
57
|
-
"npm-run-all": "^4.1.5",
|
|
58
57
|
"tape": "^5.9.0",
|
|
59
|
-
"tsup": "^8.
|
|
60
|
-
"tsx": "^4.19.
|
|
61
|
-
"typescript": "^5.
|
|
58
|
+
"tsup": "^8.4.0",
|
|
59
|
+
"tsx": "^4.19.4",
|
|
60
|
+
"typescript": "^5.8.3"
|
|
62
61
|
},
|
|
63
62
|
"dependencies": {
|
|
64
|
-
"@turf/distance": "
|
|
65
|
-
"@turf/helpers": "
|
|
63
|
+
"@turf/distance": "7.3.1",
|
|
64
|
+
"@turf/helpers": "7.3.1",
|
|
66
65
|
"@types/geojson": "^7946.0.10",
|
|
67
66
|
"tslib": "^2.8.1"
|
|
68
67
|
},
|
|
69
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "b7f1b4eafb760431e03955499d8eac9489438219"
|
|
70
69
|
}
|