Socket
Socket
Sign inDemoInstall

turf-along

Package Overview
Dependencies
5
Maintainers
7
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.10 to 3.0.12

12

index.js

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

var distance = require('turf-distance');
var measureDistance = require('turf-distance');
var point = require('turf-helpers').point;

@@ -40,3 +40,3 @@ var bearing = require('turf-bearing');

*/
module.exports = function (line, dist, units) {
module.exports = function (line, distance, units) {
var coords;

@@ -49,5 +49,5 @@ if (line.type === 'Feature') coords = line.geometry.coordinates;

for (var i = 0; i < coords.length; i++) {
if (dist >= travelled && i === coords.length - 1) break;
else if (travelled >= dist) {
var overshot = dist - travelled;
if (distance >= travelled && i === coords.length - 1) break;
else if (travelled >= distance) {
var overshot = distance - travelled;
if (!overshot) return point(coords[i]);

@@ -60,3 +60,3 @@ else {

} else {
travelled += distance(coords[i], coords[i + 1], units);
travelled += measureDistance(coords[i], coords[i + 1], units);
}

@@ -63,0 +63,0 @@ }

{
"name": "turf-along",
"version": "3.0.10",
"version": "3.0.12",
"description": "",

@@ -29,10 +29,10 @@ "main": "index.js",

"tape": "^3.5.0",
"turf-helpers": "^3.0.10"
"turf-helpers": "^3.0.12"
},
"dependencies": {
"turf-bearing": "^3.0.10",
"turf-destination": "^3.0.10",
"turf-distance": "^3.0.10",
"turf-helpers": "^3.0.10"
"turf-bearing": "^3.0.12",
"turf-destination": "^3.0.12",
"turf-distance": "^3.0.12",
"turf-helpers": "^3.0.12"
}
}
# turf-along
[![build status](https://secure.travis-ci.org/Turfjs/turf-along.png)](http://travis-ci.org/Turfjs/turf-along)
# along
Takes a [line](LineString) and returns a [point](Point) at a specified distance along the line.
**Parameters**
- `line` **Feature&lt;LineString>** input line
- `distance` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** distance along the line
- `units` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** can be degrees, radians, miles, or kilometers (optional, default `miles`)
### `turf.along(line, distance, [units=miles])`
**Examples**
Takes a LineString|line and returns a Point|point at a specified distance along the line.
### Parameters
| parameter | type | description |
| --------------- | ----------------------- | --------------------------------------------------------- |
| `line` | Feature\.\<LineString\> | input line |
| `distance` | Number | distance along the line |
| `[units=miles]` | String | _optional:_ can be degrees, radians, miles, or kilometers |
### Example
```js
```javascript
var line = {

@@ -51,9 +42,15 @@ "type": "Feature",

Returns **Feature&lt;Point>** Point `distance` `units` along the line
**Returns** `Feature.<Point>`, Point `distance` `units` along the line
---
## Installation
This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.
Requires [nodejs](http://nodejs.org/).
### Installation
Install this module individually:
```sh

@@ -63,8 +60,6 @@ $ npm install turf-along

## Tests
Or install the Turf module that includes it as a function:
```sh
$ npm test
$ npm install turf
```
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc