import Heap from 'heap-js' ; import { InsightInfo , PatternInfo , HomogeneousPatternInfo } from '../interface' ; export const insightPriorityComparator = ( a , b ) => a . score - b . score ; export const homogeneousInsightPriorityComparator = ( a , b ) => a . score - b . score ; export const addInsightsToHeap = ( insights , heap ) => { insights ?. forEach ( ( item ) => { if ( heap . length >= heap . limit ) { heap . pushpop ( item ) ; } else { heap . add ( item ) ; } } ) ; } ;