Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// separate data for DataChangeNotification (MonitoredItemNotification) from data for
// EventNotificationList(EventFieldList)
const dataChangedNotificationData = notifications_chunk.filter(
filter_instanceof.bind(null, MonitoredItemNotification));
const eventNotificationListData = notifications_chunk.filter(
filter_instanceof.bind(null, EventFieldList));
assert(notifications_chunk.length ===
dataChangedNotificationData.length + eventNotificationListData.length);
notifications = [];
// add dataChangeNotification
if (dataChangedNotificationData.length) {
const dataChangeNotification = new DataChangeNotification({
diagnosticInfos: [],
monitoredItems: dataChangedNotificationData
});
notifications.push(dataChangeNotification);
}
// add dataChangeNotification
if (eventNotificationListData.length) {
const eventNotificationList = new EventNotificationList({
events: eventNotificationListData
});
notifications.push(eventNotificationList);
}
assert(notifications.length === 1 || notifications.length === 2);