Check for the existence of multiple shortcodes with one function

Recently, I needed to check for the existence of several related shortcodes within WordPress.  Rather than writing a large if-or statement I came up with this small function that takes in an array of strings and a boolean to determine whether I needed to check for the existence of all the supplied shortcodes or just any of them.