# propReduce

Reduce properties in any GeoJSON object into a single value, similar to how Array.reduce works. However, in this case we lazily run the reduction, so an array of all properties is unnecessary.

> npm install @turf/meta


参数 类型 描述
geojson (FeatureCollection|Feature) 任何 GeoJSON 对象
callback Function a method that takes (previousValue, currentProperties, featureIndex)
initialValue (*) Value to use as the first argument to the first call of the callback.


    • The value that results from the reduction.


var features = turf.featureCollection([
    turf.point([26, 37], {foo: 'bar'}),
    turf.point([36, 53], {hello: 'world'})

turf.propReduce(features, function (previousValue, currentProperties, featureIndex) {
  return currentProperties
Last Updated: 6/21/2023, 11:40:17 PM