import { escapeRegExp } from "lodash" ; export const whitelistToRegex = ( whitelist ? ) : RegExp [ ] => whitelist === undefined ? [ ] : whitelist . map ( ( item ) => item instanceof RegExp ? item : new RegExp ( `^${ item . split ( /\*+/ ) . map ( escapeRegExp ) . join ( ".*" ) }$` ) ) ;