# 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) any GeoJSON object
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: 5/23/2021, 11:10:15 AM