@turf/meta
Advanced tools
Comparing version 6.5.0 to 7.0.0-alpha.0
@@ -9,11 +9,9 @@ import { | ||
Feature, | ||
Geometry, | ||
GeometryObject, | ||
GeometryCollection, | ||
AllGeoJSON, | ||
Properties, | ||
Geometries, | ||
Lines, | ||
GeoJsonProperties, | ||
BBox, | ||
Id, | ||
} from "@turf/helpers"; | ||
} from "geojson"; | ||
import { AllGeoJSON, Lines, Id } from "@turf/helpers"; | ||
@@ -54,3 +52,3 @@ /** | ||
*/ | ||
export function propEach<Props extends Properties>( | ||
export function propEach<Props extends GeoJsonProperties>( | ||
geojson: Feature<any> | FeatureCollection<any> | Feature<GeometryCollection>, | ||
@@ -63,8 +61,4 @@ callback: (currentProperties: Props, featureIndex: number) => void | ||
*/ | ||
export function propReduce<Reducer extends any, P = Properties>( | ||
geojson: | ||
| Feature<any, P> | ||
| FeatureCollection<any, P> | ||
| Geometries | ||
| GeometryCollection, | ||
export function propReduce<Reducer extends any, P = GeoJsonProperties>( | ||
geojson: Feature<any, P> | FeatureCollection<any, P> | Geometry, | ||
callback: ( | ||
@@ -83,4 +77,4 @@ previousValue: Reducer, | ||
Reducer extends any, | ||
G extends Geometries, | ||
P = Properties | ||
G extends GeometryObject, | ||
P = GeoJsonProperties | ||
>( | ||
@@ -102,3 +96,3 @@ geojson: | ||
*/ | ||
export function featureEach<G extends any, P = Properties>( | ||
export function featureEach<G extends GeometryObject, P = GeoJsonProperties>( | ||
geojson: | ||
@@ -121,4 +115,4 @@ | Feature<G, P> | ||
Reducer extends any, | ||
G extends Geometries, | ||
P = Properties | ||
G extends GeometryObject, | ||
P = GeoJsonProperties | ||
>( | ||
@@ -145,3 +139,6 @@ geojson: | ||
*/ | ||
export function geomEach<G extends Geometries | null, P = Properties>( | ||
export function geomEach< | ||
G extends GeometryObject | null, | ||
P = GeoJsonProperties | ||
>( | ||
geojson: | ||
@@ -167,4 +164,4 @@ | Feature<G, P> | ||
Reducer extends any, | ||
G extends Geometries, | ||
P = Properties | ||
G extends GeometryObject, | ||
P = GeoJsonProperties | ||
>( | ||
@@ -189,3 +186,6 @@ geojson: | ||
*/ | ||
export function flattenEach<G = Geometries, P = Properties>( | ||
export function flattenEach< | ||
G extends GeometryObject = GeometryObject, | ||
P = GeoJsonProperties | ||
>( | ||
geojson: | ||
@@ -207,3 +207,3 @@ | Feature<G, P> | ||
*/ | ||
export function segmentReduce<Reducer extends any, P = Properties>( | ||
export function segmentReduce<Reducer extends any, P = GeoJsonProperties>( | ||
geojson: | ||
@@ -229,3 +229,3 @@ | FeatureCollection<Lines, P> | ||
*/ | ||
export function segmentEach<P = Properties>( | ||
export function segmentEach<P = GeoJsonProperties>( | ||
geojson: AllGeoJSON, | ||
@@ -244,3 +244,3 @@ callback: ( | ||
*/ | ||
export function lineReduce<Reducer extends any, P = Properties>( | ||
export function lineReduce<Reducer extends any, P = GeoJsonProperties>( | ||
geojson: | ||
@@ -265,3 +265,3 @@ | FeatureCollection<Lines, P> | ||
*/ | ||
export function lineEach<P = Properties>( | ||
export function lineEach<P = GeoJsonProperties>( | ||
geojson: | ||
@@ -274,3 +274,3 @@ | FeatureCollection<Lines, P> | ||
callback: ( | ||
currentLine?: Feature<LineString, P>, | ||
currentLine: Feature<LineString, P>, | ||
featureIndex?: number, | ||
@@ -287,3 +287,3 @@ multiFeatureIndex?: number, | ||
G extends LineString | MultiLineString | Polygon | MultiPolygon, | ||
P = Properties | ||
P = GeoJsonProperties | ||
>( | ||
@@ -305,3 +305,3 @@ geojson: Feature<G, P> | FeatureCollection<G, P> | G, | ||
*/ | ||
export function findPoint<G extends GeometryObject, P = Properties>( | ||
export function findPoint<G extends GeometryObject, P = GeoJsonProperties>( | ||
geojson: Feature<G, P> | FeatureCollection<G, P> | G, | ||
@@ -308,0 +308,0 @@ options?: { |
{ | ||
"name": "@turf/meta", | ||
"version": "6.5.0", | ||
"version": "7.0.0-alpha.0", | ||
"description": "turf meta module", | ||
@@ -67,6 +67,6 @@ "author": "Turf Authors", | ||
"test:tape": "node -r esm test.js", | ||
"test:types": "tsc --esModuleInterop --noEmit types.ts" | ||
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts" | ||
}, | ||
"devDependencies": { | ||
"@turf/random": "^6.5.0", | ||
"@turf/random": "^7.0.0-alpha.0", | ||
"benchmark": "*", | ||
@@ -78,5 +78,5 @@ "npm-run-all": "*", | ||
"dependencies": { | ||
"@turf/helpers": "^6.5.0" | ||
"@turf/helpers": "^7.0.0-alpha.0" | ||
}, | ||
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e" | ||
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189" | ||
} |
434
README.md
@@ -11,9 +11,9 @@ # @turf/meta | ||
**Parameters** | ||
### Parameters | ||
- `currentCoord` **[Array][2]<[number][3]>** The current coordinate being processed. | ||
- `coordIndex` **[number][3]** The current index of the coordinate being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
- `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
- `geometryIndex` **[number][3]** The current index of the Geometry being processed. | ||
* `currentCoord` **[Array][2]<[number][3]>** The current coordinate being processed. | ||
* `coordIndex` **[number][3]** The current index of the coordinate being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
* `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
* `geometryIndex` **[number][3]** The current index of the Geometry being processed. | ||
@@ -24,9 +24,9 @@ ## coordEach | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** any GeoJSON object | ||
- `callback` **[Function][1]** a method that takes (currentCoord, coordIndex, featureIndex, multiFeatureIndex) | ||
- `excludeWrapCoord` **[boolean][7]** whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration. (optional, default `false`) | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** any GeoJSON object | ||
* `callback` **[Function][1]** a method that takes (currentCoord, coordIndex, featureIndex, multiFeatureIndex) | ||
* `excludeWrapCoord` **[boolean][7]** whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration. (optional, default `false`) | ||
**Examples** | ||
### Examples | ||
@@ -50,2 +50,32 @@ ```javascript | ||
## coordReduceCallback | ||
Callback for coordReduce | ||
The first time the callback function is called, the values provided as arguments depend | ||
on whether the reduce method has an initialValue argument. | ||
If an initialValue is provided to the reduce method: | ||
* The previousValue argument is initialValue. | ||
* The currentValue argument is the value of the first element present in the array. | ||
If an initialValue is not provided: | ||
* The previousValue argument is the value of the first element present in the array. | ||
* The currentValue argument is the value of the second element present in the array. | ||
Type: [Function][1] | ||
### Parameters | ||
* `previousValue` **any** The accumulated value previously returned in the last invocation | ||
of the callback, or initialValue, if supplied. | ||
* `currentCoord` **[Array][2]<[number][3]>** The current coordinate being processed. | ||
* `coordIndex` **[number][3]** The current index of the coordinate being processed. | ||
Starts at index 0, if an initialValue is provided, and at index 1 otherwise. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
* `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
* `geometryIndex` **[number][3]** The current index of the Geometry being processed. | ||
## coordReduce | ||
@@ -55,10 +85,10 @@ | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Geometry][6] \| [Feature][5])** any GeoJSON object | ||
- `callback` **[Function][1]** a method that takes (previousValue, currentCoord, coordIndex) | ||
- `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
- `excludeWrapCoord` **[boolean][7]** whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration. (optional, default `false`) | ||
* `geojson` **([FeatureCollection][4] | [Geometry][6] | [Feature][5])** any GeoJSON object | ||
* `callback` **[Function][1]** a method that takes (previousValue, currentCoord, coordIndex) | ||
* `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
* `excludeWrapCoord` **[boolean][7]** whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration. (optional, default `false`) | ||
**Examples** | ||
### Examples | ||
@@ -84,31 +114,12 @@ ```javascript | ||
## coordReduceCallback | ||
## propEachCallback | ||
Callback for coordReduce | ||
Callback for propEach | ||
The first time the callback function is called, the values provided as arguments depend | ||
on whether the reduce method has an initialValue argument. | ||
If an initialValue is provided to the reduce method: | ||
- The previousValue argument is initialValue. | ||
- The currentValue argument is the value of the first element present in the array. | ||
If an initialValue is not provided: | ||
- The previousValue argument is the value of the first element present in the array. | ||
- The currentValue argument is the value of the second element present in the array. | ||
Type: [Function][1] | ||
**Parameters** | ||
### Parameters | ||
- `previousValue` **any** The accumulated value previously returned in the last invocation | ||
of the callback, or initialValue, if supplied. | ||
- `currentCoord` **[Array][2]<[number][3]>** The current coordinate being processed. | ||
- `coordIndex` **[number][3]** The current index of the coordinate being processed. | ||
Starts at index 0, if an initialValue is provided, and at index 1 otherwise. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
- `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
- `geometryIndex` **[number][3]** The current index of the Geometry being processed. | ||
* `currentProperties` **[Object][8]** The current Properties being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
@@ -119,8 +130,8 @@ ## propEach | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5])** any GeoJSON object | ||
- `callback` **[Function][1]** a method that takes (currentProperties, featureIndex) | ||
* `geojson` **([FeatureCollection][4] | [Feature][5])** any GeoJSON object | ||
* `callback` **[Function][1]** a method that takes (currentProperties, featureIndex) | ||
**Examples** | ||
### Examples | ||
@@ -141,13 +152,2 @@ ```javascript | ||
## propEachCallback | ||
Callback for propEach | ||
Type: [Function][1] | ||
**Parameters** | ||
- `currentProperties` **[Object][8]** The current Properties being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
## propReduceCallback | ||
@@ -162,18 +162,18 @@ | ||
- The previousValue argument is initialValue. | ||
- The currentValue argument is the value of the first element present in the array. | ||
* The previousValue argument is initialValue. | ||
* The currentValue argument is the value of the first element present in the array. | ||
If an initialValue is not provided: | ||
- The previousValue argument is the value of the first element present in the array. | ||
- The currentValue argument is the value of the second element present in the array. | ||
* The previousValue argument is the value of the first element present in the array. | ||
* The currentValue argument is the value of the second element present in the array. | ||
Type: [Function][1] | ||
**Parameters** | ||
### Parameters | ||
- `previousValue` **any** The accumulated value previously returned in the last invocation | ||
* `previousValue` **any** The accumulated value previously returned in the last invocation | ||
of the callback, or initialValue, if supplied. | ||
- `currentProperties` **any** The current Properties being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
* `currentProperties` **any** The current Properties being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
@@ -186,9 +186,9 @@ ## propReduce | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5])** any GeoJSON object | ||
- `callback` **[Function][1]** a method that takes (previousValue, currentProperties, featureIndex) | ||
- `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
* `geojson` **([FeatureCollection][4] | [Feature][5])** any GeoJSON object | ||
* `callback` **[Function][1]** a method that takes (previousValue, currentProperties, featureIndex) | ||
* `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
**Examples** | ||
### Examples | ||
@@ -217,6 +217,6 @@ ```javascript | ||
**Parameters** | ||
### Parameters | ||
- `currentFeature` **[Feature][5]<any>** The current Feature being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
* `currentFeature` **[Feature][5]\<any>** The current Feature being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
@@ -228,8 +228,8 @@ ## featureEach | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** any GeoJSON object | ||
- `callback` **[Function][1]** a method that takes (currentFeature, featureIndex) | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** any GeoJSON object | ||
* `callback` **[Function][1]** a method that takes (currentFeature, featureIndex) | ||
**Examples** | ||
### Examples | ||
@@ -259,18 +259,18 @@ ```javascript | ||
- The previousValue argument is initialValue. | ||
- The currentValue argument is the value of the first element present in the array. | ||
* The previousValue argument is initialValue. | ||
* The currentValue argument is the value of the first element present in the array. | ||
If an initialValue is not provided: | ||
- The previousValue argument is the value of the first element present in the array. | ||
- The currentValue argument is the value of the second element present in the array. | ||
* The previousValue argument is the value of the first element present in the array. | ||
* The currentValue argument is the value of the second element present in the array. | ||
Type: [Function][1] | ||
**Parameters** | ||
### Parameters | ||
- `previousValue` **any** The accumulated value previously returned in the last invocation | ||
* `previousValue` **any** The accumulated value previously returned in the last invocation | ||
of the callback, or initialValue, if supplied. | ||
- `currentFeature` **[Feature][5]** The current Feature being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
* `currentFeature` **[Feature][5]** The current Feature being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
@@ -281,9 +281,9 @@ ## featureReduce | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** any GeoJSON object | ||
- `callback` **[Function][1]** a method that takes (previousValue, currentFeature, featureIndex) | ||
- `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** any GeoJSON object | ||
* `callback` **[Function][1]** a method that takes (previousValue, currentFeature, featureIndex) | ||
* `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
**Examples** | ||
### Examples | ||
@@ -310,7 +310,7 @@ ```javascript | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** any GeoJSON object | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** any GeoJSON object | ||
**Examples** | ||
### Examples | ||
@@ -327,3 +327,3 @@ ```javascript | ||
Returns **[Array][2]<[Array][2]<[number][3]>>** coordinate position array | ||
Returns **[Array][2]<[Array][2]<[number][3]>>** coordinate position array | ||
@@ -336,9 +336,9 @@ ## geomEachCallback | ||
**Parameters** | ||
### Parameters | ||
- `currentGeometry` **[Geometry][6]** The current Geometry being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
- `featureProperties` **[Object][8]** The current Feature Properties being processed. | ||
- `featureBBox` **[Array][2]<[number][3]>** The current Feature BBox being processed. | ||
- `featureId` **([number][3] \| [string][9])** The current Feature Id being processed. | ||
* `currentGeometry` **[Geometry][6]** The current Geometry being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
* `featureProperties` **[Object][8]** The current Feature Properties being processed. | ||
* `featureBBox` **[Array][2]<[number][3]>** The current Feature BBox being processed. | ||
* `featureId` **([number][3] | [string][9])** The current Feature Id being processed. | ||
@@ -349,8 +349,8 @@ ## geomEach | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** any GeoJSON object | ||
- `callback` **[Function][1]** a method that takes (currentGeometry, featureIndex, featureProperties, featureBBox, featureId) | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** any GeoJSON object | ||
* `callback` **[Function][1]** a method that takes (currentGeometry, featureIndex, featureProperties, featureBBox, featureId) | ||
**Examples** | ||
### Examples | ||
@@ -383,21 +383,21 @@ ```javascript | ||
- The previousValue argument is initialValue. | ||
- The currentValue argument is the value of the first element present in the array. | ||
* The previousValue argument is initialValue. | ||
* The currentValue argument is the value of the first element present in the array. | ||
If an initialValue is not provided: | ||
- The previousValue argument is the value of the first element present in the array. | ||
- The currentValue argument is the value of the second element present in the array. | ||
* The previousValue argument is the value of the first element present in the array. | ||
* The currentValue argument is the value of the second element present in the array. | ||
Type: [Function][1] | ||
**Parameters** | ||
### Parameters | ||
- `previousValue` **any** The accumulated value previously returned in the last invocation | ||
* `previousValue` **any** The accumulated value previously returned in the last invocation | ||
of the callback, or initialValue, if supplied. | ||
- `currentGeometry` **[Geometry][6]** The current Geometry being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
- `featureProperties` **[Object][8]** The current Feature Properties being processed. | ||
- `featureBBox` **[Array][2]<[number][3]>** The current Feature BBox being processed. | ||
- `featureId` **([number][3] \| [string][9])** The current Feature Id being processed. | ||
* `currentGeometry` **[Geometry][6]** The current Geometry being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
* `featureProperties` **[Object][8]** The current Feature Properties being processed. | ||
* `featureBBox` **[Array][2]<[number][3]>** The current Feature BBox being processed. | ||
* `featureId` **([number][3] | [string][9])** The current Feature Id being processed. | ||
@@ -408,9 +408,9 @@ ## geomReduce | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** any GeoJSON object | ||
- `callback` **[Function][1]** a method that takes (previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId) | ||
- `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** any GeoJSON object | ||
* `callback` **[Function][1]** a method that takes (previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId) | ||
* `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
**Examples** | ||
### Examples | ||
@@ -442,7 +442,7 @@ ```javascript | ||
**Parameters** | ||
### Parameters | ||
- `currentFeature` **[Feature][5]** The current flattened feature being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
- `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
* `currentFeature` **[Feature][5]** The current flattened feature being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
* `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
@@ -454,8 +454,8 @@ ## flattenEach | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** any GeoJSON object | ||
- `callback` **[Function][1]** a method that takes (currentFeature, featureIndex, multiFeatureIndex) | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** any GeoJSON object | ||
* `callback` **[Function][1]** a method that takes (currentFeature, featureIndex, multiFeatureIndex) | ||
**Examples** | ||
### Examples | ||
@@ -484,19 +484,19 @@ ```javascript | ||
- The previousValue argument is initialValue. | ||
- The currentValue argument is the value of the first element present in the array. | ||
* The previousValue argument is initialValue. | ||
* The currentValue argument is the value of the first element present in the array. | ||
If an initialValue is not provided: | ||
- The previousValue argument is the value of the first element present in the array. | ||
- The currentValue argument is the value of the second element present in the array. | ||
* The previousValue argument is the value of the first element present in the array. | ||
* The currentValue argument is the value of the second element present in the array. | ||
Type: [Function][1] | ||
**Parameters** | ||
### Parameters | ||
- `previousValue` **any** The accumulated value previously returned in the last invocation | ||
* `previousValue` **any** The accumulated value previously returned in the last invocation | ||
of the callback, or initialValue, if supplied. | ||
- `currentFeature` **[Feature][5]** The current Feature being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
- `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
* `currentFeature` **[Feature][5]** The current Feature being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
* `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
@@ -507,9 +507,9 @@ ## flattenReduce | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** any GeoJSON object | ||
- `callback` **[Function][1]** a method that takes (previousValue, currentFeature, featureIndex, multiFeatureIndex) | ||
- `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** any GeoJSON object | ||
* `callback` **[Function][1]** a method that takes (previousValue, currentFeature, featureIndex, multiFeatureIndex) | ||
* `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
**Examples** | ||
### Examples | ||
@@ -539,9 +539,9 @@ ```javascript | ||
**Parameters** | ||
### Parameters | ||
- `currentSegment` **[Feature][5]<[LineString][10]>** The current Segment being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
- `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
- `geometryIndex` **[number][3]** The current index of the Geometry being processed. | ||
- `segmentIndex` **[number][3]** The current index of the Segment being processed. | ||
* `currentSegment` **[Feature][5]<[LineString][10]>** The current Segment being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
* `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
* `geometryIndex` **[number][3]** The current index of the Geometry being processed. | ||
* `segmentIndex` **[number][3]** The current index of the Segment being processed. | ||
@@ -555,8 +555,8 @@ Returns **void** | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** any GeoJSON | ||
- `callback` **[Function][1]** a method that takes (currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** any GeoJSON | ||
* `callback` **[Function][1]** a method that takes (currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) | ||
**Examples** | ||
### Examples | ||
@@ -593,21 +593,21 @@ ```javascript | ||
- The previousValue argument is initialValue. | ||
- The currentValue argument is the value of the first element present in the array. | ||
* The previousValue argument is initialValue. | ||
* The currentValue argument is the value of the first element present in the array. | ||
If an initialValue is not provided: | ||
- The previousValue argument is the value of the first element present in the array. | ||
- The currentValue argument is the value of the second element present in the array. | ||
* The previousValue argument is the value of the first element present in the array. | ||
* The currentValue argument is the value of the second element present in the array. | ||
Type: [Function][1] | ||
**Parameters** | ||
### Parameters | ||
- `previousValue` **any** The accumulated value previously returned in the last invocation | ||
* `previousValue` **any** The accumulated value previously returned in the last invocation | ||
of the callback, or initialValue, if supplied. | ||
- `currentSegment` **[Feature][5]<[LineString][10]>** The current Segment being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
- `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
- `geometryIndex` **[number][3]** The current index of the Geometry being processed. | ||
- `segmentIndex` **[number][3]** The current index of the Segment being processed. | ||
* `currentSegment` **[Feature][5]<[LineString][10]>** The current Segment being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed. | ||
* `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed. | ||
* `geometryIndex` **[number][3]** The current index of the Geometry being processed. | ||
* `segmentIndex` **[number][3]** The current index of the Segment being processed. | ||
@@ -619,9 +619,9 @@ ## segmentReduce | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** any GeoJSON | ||
- `callback` **[Function][1]** a method that takes (previousValue, currentSegment, currentIndex) | ||
- `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** any GeoJSON | ||
* `callback` **[Function][1]** a method that takes (previousValue, currentSegment, currentIndex) | ||
* `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
**Examples** | ||
### Examples | ||
@@ -638,3 +638,3 @@ ```javascript | ||
//= geometryIndex | ||
//= segmentInex | ||
//= segmentIndex | ||
return currentSegment | ||
@@ -659,8 +659,8 @@ }); | ||
**Parameters** | ||
### Parameters | ||
- `currentLine` **[Feature][5]<[LineString][10]>** The current LineString|LinearRing being processed | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed | ||
- `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed | ||
- `geometryIndex` **[number][3]** The current index of the Geometry being processed | ||
* `currentLine` **[Feature][5]<[LineString][10]>** The current LineString|LinearRing being processed | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed | ||
* `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed | ||
* `geometryIndex` **[number][3]** The current index of the Geometry being processed | ||
@@ -672,8 +672,8 @@ ## lineEach | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([Geometry][6] \| [Feature][5]<([LineString][10] \| [Polygon][11] \| [MultiLineString][12] \| [MultiPolygon][13])>)** object | ||
- `callback` **[Function][1]** a method that takes (currentLine, featureIndex, multiFeatureIndex, geometryIndex) | ||
* `geojson` **([Geometry][6] | [Feature][5]<([LineString][10] | [Polygon][11] | [MultiLineString][12] | [MultiPolygon][13])>)** object | ||
* `callback` **[Function][1]** a method that takes (currentLine, featureIndex, multiFeatureIndex, geometryIndex) | ||
**Examples** | ||
### Examples | ||
@@ -703,20 +703,20 @@ ```javascript | ||
- The previousValue argument is initialValue. | ||
- The currentValue argument is the value of the first element present in the array. | ||
* The previousValue argument is initialValue. | ||
* The currentValue argument is the value of the first element present in the array. | ||
If an initialValue is not provided: | ||
- The previousValue argument is the value of the first element present in the array. | ||
- The currentValue argument is the value of the second element present in the array. | ||
* The previousValue argument is the value of the first element present in the array. | ||
* The currentValue argument is the value of the second element present in the array. | ||
Type: [Function][1] | ||
**Parameters** | ||
### Parameters | ||
- `previousValue` **any** The accumulated value previously returned in the last invocation | ||
* `previousValue` **any** The accumulated value previously returned in the last invocation | ||
of the callback, or initialValue, if supplied. | ||
- `currentLine` **[Feature][5]<[LineString][10]>** The current LineString|LinearRing being processed. | ||
- `featureIndex` **[number][3]** The current index of the Feature being processed | ||
- `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed | ||
- `geometryIndex` **[number][3]** The current index of the Geometry being processed | ||
* `currentLine` **[Feature][5]<[LineString][10]>** The current LineString|LinearRing being processed. | ||
* `featureIndex` **[number][3]** The current index of the Feature being processed | ||
* `multiFeatureIndex` **[number][3]** The current index of the Multi-Feature being processed | ||
* `geometryIndex` **[number][3]** The current index of the Geometry being processed | ||
@@ -727,9 +727,9 @@ ## lineReduce | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([Geometry][6] \| [Feature][5]<([LineString][10] \| [Polygon][11] \| [MultiLineString][12] \| [MultiPolygon][13])>)** object | ||
- `callback` **[Function][1]** a method that takes (previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex) | ||
- `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
* `geojson` **([Geometry][6] | [Feature][5]<([LineString][10] | [Polygon][11] | [MultiLineString][12] | [MultiPolygon][13])>)** object | ||
* `callback` **[Function][1]** a method that takes (previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex) | ||
* `initialValue` **any?** Value to use as the first argument to the first call of the callback. | ||
**Examples** | ||
### Examples | ||
@@ -761,16 +761,17 @@ ```javascript | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** Any GeoJSON Feature or Geometry | ||
- `options` **[Object][8]** Optional parameters (optional, default `{}`) | ||
- `options.featureIndex` **[number][3]** Feature Index (optional, default `0`) | ||
- `options.multiFeatureIndex` **[number][3]** Multi-Feature Index (optional, default `0`) | ||
- `options.geometryIndex` **[number][3]** Geometry Index (optional, default `0`) | ||
- `options.segmentIndex` **[number][3]** Segment Index (optional, default `0`) | ||
- `options.properties` **[Object][8]** Translate Properties to output LineString (optional, default `{}`) | ||
- `options.bbox` **[BBox][14]** Translate BBox to output LineString (optional, default `{}`) | ||
- `options.id` **([number][3] \| [string][9])** Translate Id to output LineString (optional, default `{}`) | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** Any GeoJSON Feature or Geometry | ||
* `options` **[Object][8]** Optional parameters (optional, default `{}`) | ||
**Examples** | ||
* `options.featureIndex` **[number][3]** Feature Index (optional, default `0`) | ||
* `options.multiFeatureIndex` **[number][3]** Multi-Feature Index (optional, default `0`) | ||
* `options.geometryIndex` **[number][3]** Geometry Index (optional, default `0`) | ||
* `options.segmentIndex` **[number][3]** Segment Index (optional, default `0`) | ||
* `options.properties` **[Object][8]** Translate Properties to output LineString (optional, default `{}`) | ||
* `options.bbox` **[BBox][14]** Translate BBox to output LineString (optional, default `{}`) | ||
* `options.id` **([number][3] | [string][9])** Translate Id to output LineString (optional, default `{}`) | ||
### Examples | ||
```javascript | ||
@@ -795,3 +796,3 @@ var multiLine = turf.multiLineString([ | ||
Returns **[Feature][5]<[LineString][10]>** 2-vertex GeoJSON Feature LineString | ||
Returns **[Feature][5]<[LineString][10]>** 2-vertex GeoJSON Feature LineString | ||
@@ -804,16 +805,17 @@ ## findPoint | ||
**Parameters** | ||
### Parameters | ||
- `geojson` **([FeatureCollection][4] \| [Feature][5] \| [Geometry][6])** Any GeoJSON Feature or Geometry | ||
- `options` **[Object][8]** Optional parameters (optional, default `{}`) | ||
- `options.featureIndex` **[number][3]** Feature Index (optional, default `0`) | ||
- `options.multiFeatureIndex` **[number][3]** Multi-Feature Index (optional, default `0`) | ||
- `options.geometryIndex` **[number][3]** Geometry Index (optional, default `0`) | ||
- `options.coordIndex` **[number][3]** Coord Index (optional, default `0`) | ||
- `options.properties` **[Object][8]** Translate Properties to output Point (optional, default `{}`) | ||
- `options.bbox` **[BBox][14]** Translate BBox to output Point (optional, default `{}`) | ||
- `options.id` **([number][3] \| [string][9])** Translate Id to output Point (optional, default `{}`) | ||
* `geojson` **([FeatureCollection][4] | [Feature][5] | [Geometry][6])** Any GeoJSON Feature or Geometry | ||
* `options` **[Object][8]** Optional parameters (optional, default `{}`) | ||
**Examples** | ||
* `options.featureIndex` **[number][3]** Feature Index (optional, default `0`) | ||
* `options.multiFeatureIndex` **[number][3]** Multi-Feature Index (optional, default `0`) | ||
* `options.geometryIndex` **[number][3]** Geometry Index (optional, default `0`) | ||
* `options.coordIndex` **[number][3]** Coord Index (optional, default `0`) | ||
* `options.properties` **[Object][8]** Translate Properties to output Point (optional, default `{}`) | ||
* `options.bbox` **[BBox][14]** Translate BBox to output Point (optional, default `{}`) | ||
* `options.id` **([number][3] | [string][9])** Translate Id to output Point (optional, default `{}`) | ||
### Examples | ||
```javascript | ||
@@ -838,3 +840,3 @@ var multiLine = turf.multiLineString([ | ||
Returns **[Feature][5]<[Point][15]>** 2-vertex GeoJSON Feature Point | ||
Returns **[Feature][5]<[Point][15]>** 2-vertex GeoJSON Feature Point | ||
@@ -841,0 +843,0 @@ [1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
163580
8
3650
861
1
+ Added@turf/helpers@7.1.0(transitive)
+ Added@types/geojson@7946.0.14(transitive)
+ Addedtslib@2.8.1(transitive)
- Removed@turf/helpers@6.5.0(transitive)
Updated@turf/helpers@^7.0.0-alpha.0