UNPKG

kafka-ts

Version:

**KafkaTS** is a Apache Kafka client library for Node.js. It provides both a low-level API for communicating directly with the Apache Kafka cluster and high-level APIs for publishing and subscribing to Kafka topics.

14 lines (13 loc) 449 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.groupByLeaderId = void 0; const groupByLeaderId = (items, leaderIdByTopicPartition) => { const result = {}; items.forEach((item) => { const leaderId = leaderIdByTopicPartition[item.topic][item.partition]; result[leaderId] ??= []; result[leaderId].push(item); }); return result; }; exports.groupByLeaderId = groupByLeaderId;