in packages/dynamodb-query-iterator/src/mergeConsumedCapacities.ts [49:71]
function mergeCapacityMaps(
a?: SecondaryIndexesCapacityMap,
b?: SecondaryIndexesCapacityMap
): SecondaryIndexesCapacityMap|undefined {
if (a || b) {
const out: SecondaryIndexesCapacityMap = {};
a = a || {};
b = b || {};
const keys = new Set<string>();
for (const map of [a, b]) {
for (const indexName of Object.keys(map)) {
keys.add(indexName);
}
}
for (const key of keys) {
out[key] = mergeCapacities(a[key], b[key])!;
}
return out;
}
}