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.
18 lines (17 loc) • 464 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.shared = void 0;
const shared = (func) => {
let promises = {};
return (...args) => {
const key = JSON.stringify(args);
if (!promises[key]) {
promises[key] = func(...args);
promises[key].finally(() => {
delete promises[key];
});
}
return promises[key];
};
};
exports.shared = shared;