Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function itemsMatchingStamp(
stamp: Time,
itemsByPath: MessageHistoryItemsByPath,
getHeaderStamp?: (itemMessage: Message) => ?Time
): ?MessageHistoryItemsByPath {
const synchronizedItemsByPath = {};
for (const path in itemsByPath) {
let found = false;
for (const item of itemsByPath[path]) {
const thisStamp = getHeaderStamp
? getHeaderStamp(item.message)
: get(item.message, ["message", "header", "stamp"]);
if (thisStamp && TimeUtil.areSame(stamp, thisStamp)) {
found = true;
synchronizedItemsByPath[path] = [item];
break;
}
}
if (!found) {
return null;
}
}
return synchronizedItemsByPath;
}
hasLifetime() {
return !TimeUtil.areSame(this.getLifetime(), ZERO_TIME);
}
}
const matchingMessage = messages[topic].find(({ message }) => {
const thisStamp = get(message, ["header", "stamp"]);
return thisStamp && TimeUtil.areSame(stamp, thisStamp);
});
if (!matchingMessage) {