@turf/truncate
Advanced tools
Comparing version 7.1.0 to 7.2.0
@@ -6,3 +6,3 @@ import { AllGeoJSON } from '@turf/helpers'; | ||
* | ||
* @name truncate | ||
* @function | ||
* @param {GeoJSON} geojson any GeoJSON Feature, FeatureCollection, Geometry or GeometryCollection. | ||
@@ -9,0 +9,0 @@ * @param {Object} [options={}] Optional parameters |
@@ -6,4 +6,3 @@ // index.ts | ||
options = options != null ? options : {}; | ||
if (!isObject(options)) | ||
throw new Error("options is invalid"); | ||
if (!isObject(options)) throw new Error("options is invalid"); | ||
var precision = options.precision; | ||
@@ -14,4 +13,3 @@ var coordinates = options.coordinates; | ||
coordinates = coordinates === void 0 || coordinates === null || isNaN(coordinates) ? 3 : coordinates; | ||
if (!geojson) | ||
throw new Error("<geojson> is required"); | ||
if (!geojson) throw new Error("<geojson> is required"); | ||
if (typeof precision !== "number") | ||
@@ -30,4 +28,3 @@ throw new Error("<precision> must be a number"); | ||
function truncateCoords(coords, factor, coordinates) { | ||
if (coords.length > coordinates) | ||
coords.splice(coordinates, coords.length); | ||
if (coords.length > coordinates) coords.splice(coordinates, coords.length); | ||
for (var i = 0; i < coords.length; i++) { | ||
@@ -34,0 +31,0 @@ coords[i] = Math.round(coords[i] * factor) / factor; |
{ | ||
"name": "@turf/truncate", | ||
"version": "7.1.0", | ||
"version": "7.2.0", | ||
"description": "turf truncate module", | ||
@@ -59,19 +59,19 @@ "author": "Turf Authors", | ||
"@types/benchmark": "^2.1.5", | ||
"@types/tape": "^4.2.32", | ||
"@types/tape": "^4.13.4", | ||
"benchmark": "^2.1.4", | ||
"load-json-file": "^7.0.1", | ||
"npm-run-all": "^4.1.5", | ||
"tape": "^5.7.2", | ||
"tsup": "^8.0.1", | ||
"tsx": "^4.6.2", | ||
"typescript": "^5.2.2", | ||
"tape": "^5.9.0", | ||
"tsup": "^8.3.5", | ||
"tsx": "^4.19.2", | ||
"typescript": "^5.5.4", | ||
"write-json-file": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"@turf/helpers": "^7.1.0", | ||
"@turf/meta": "^7.1.0", | ||
"@turf/helpers": "^7.2.0", | ||
"@turf/meta": "^7.2.0", | ||
"@types/geojson": "^7946.0.10", | ||
"tslib": "^2.6.2" | ||
"tslib": "^2.8.1" | ||
}, | ||
"gitHead": "68915eeebc9278bb40dec3f1034499698a0561ef" | ||
"gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
19548
99
Updated@turf/helpers@^7.2.0
Updated@turf/meta@^7.2.0
Updatedtslib@^2.8.1