New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@turf/length

Package Overview
Dependencies
Maintainers
7
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/length - npm Package Compare versions

Comparing version 6.5.0 to 7.0.0-alpha.0

7

dist/es/index.js

@@ -19,9 +19,8 @@ import distance from "@turf/distance";

*/
export default function length(geojson, options) {
if (options === void 0) { options = {}; }
export default function length(geojson, options = {}) {
// Calculate distance from 2-vertex line segments
return segmentReduce(geojson, function (previousValue, segment) {
var coords = segment.geometry.coordinates;
return segmentReduce(geojson, (previousValue, segment) => {
const coords = segment.geometry.coordinates;
return previousValue + distance(coords[0], coords[1], options);
}, 0);
}

@@ -1,2 +0,3 @@

import { Feature, FeatureCollection, GeometryCollection, Units } from "@turf/helpers";
import { Feature, FeatureCollection, GeometryCollection } from "geojson";
import { Units } from "@turf/helpers";
/**

@@ -3,0 +4,0 @@ * Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var distance_1 = __importDefault(require("@turf/distance"));
var meta_1 = require("@turf/meta");
const tslib_1 = require("tslib");
const distance_1 = tslib_1.__importDefault(require("@turf/distance"));
const meta_1 = require("@turf/meta");
/**

@@ -24,7 +22,6 @@ * Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.

*/
function length(geojson, options) {
if (options === void 0) { options = {}; }
function length(geojson, options = {}) {
// Calculate distance from 2-vertex line segments
return meta_1.segmentReduce(geojson, function (previousValue, segment) {
var coords = segment.geometry.coordinates;
return meta_1.segmentReduce(geojson, (previousValue, segment) => {
const coords = segment.geometry.coordinates;
return previousValue + distance_1.default(coords[0], coords[1], options);

@@ -31,0 +28,0 @@ }, 0);

{
"name": "@turf/length",
"version": "6.5.0",
"version": "7.0.0-alpha.0",
"description": "turf length module",

@@ -66,7 +66,8 @@ "author": "Turf Authors",

"dependencies": {
"@turf/distance": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/meta": "^6.5.0"
"@turf/distance": "^7.0.0-alpha.0",
"@turf/helpers": "^7.0.0-alpha.0",
"@turf/meta": "^7.0.0-alpha.0",
"tslib": "^2.3.0"
},
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
}

@@ -9,10 +9,11 @@ # @turf/length

**Parameters**
### Parameters
- `geojson` **[Feature][3]<([LineString][4] \| [MultiLineString][5])>** GeoJSON to measure
- `options` **[Object][6]** Optional parameters (optional, default `{}`)
- `options.units` **[string][7]** can be degrees, radians, miles, or kilometers (optional, default `kilometers`)
* `geojson` **[Feature][3]<([LineString][4] | [MultiLineString][5])>** GeoJSON to measure
* `options` **[Object][6]** Optional parameters (optional, default `{}`)
**Examples**
* `options.units` **[string][7]** can be degrees, radians, miles, or kilometers (optional, default `kilometers`)
### Examples
```javascript

@@ -19,0 +20,0 @@ var line = turf.lineString([[115, -32], [131, -22], [143, -25], [150, -34]]);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc