export function uniqueBy < T > ( items , getKey ) { const keyedItems = new Map < unknown , T > ( ) ; for ( const item of items ) { keyedItems . set ( getKey ( item ) , item ) ; } return [ ... keyedItems . values ( ) ] ; } export function * regexExec ( regex , text ) { const regexCopy = new RegExp ( regex , "g" ) ; let match ; while ( ( match = regexCopy . exec ( text ) ) != null ) { yield match ; } }