This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I didn't like the original for two reasons: | |
# 1) joining strings into a regex with "|" smells like a future bug to me | |
# (unless you will never match on anything containing '|') | |
# 2) always using regex smells to me. why not leave that decision to the | |
# user of this method? I offer two alternatives, based on === and ==. | |
# 3) this might be premature optimization, but I've skipped the map step | |
# to save memory and time in calling methods that may not be used. | |
# true if any fields of this object match any of the values | |
# (implicitly converting values to case insensitive Regexp, as in original) |