clusterReduceCallback
描述
🌐 Description
clusterReduce 的回调函数
🌐 Callback for clusterReduce
回调函数第一次被调用时,作为参数提供的值取决于 reduce 方法是否有 initialValue 参数。
🌐 The first time the callback function is called, the values provided as arguments depend on whether the reduce method has an initialValue argument.
如果为 reduce 方法提供了 initialValue:
🌐 If an initialValue is provided to the reduce method:
- previousValue 参数是 initialValue。
- currentValue 参数是数组中第一个元素的值。
如果未提供 initialValue:
🌐 If an initialValue is not provided:
- previousValue 参数是数组中第一个元素的值。
- currentValue 参数是数组中第二个元素的值。
定义
🌐 Definition
函数 (
🌐 function (
| 名称 | 类型 | 描述 |
|---|---|---|
| 前值? | * | 累计值在回调的最后一次调用中返回,或如果提供了初始值(initialValue)。 |
| cluster? | [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) | 当前正在处理的集群。 |
| clusterValue? | * | 用于创建集群的值正在处理。 |
| currentIndex? | [number](https://web.nodejs.cn/docs/Web/JavaScript/Reference/Global_Objects/Number) | 当前数组中正在处理的元素的索引。如果提供初始值,则从索引0开始;否则从索引1开始。 |
)
返回
🌐 Returns
void