Skip to content

Instantly share code, notes, and snippets.

View nevans's full-sized avatar

nicholas a. evans nevans

View GitHub Profile
@nevans
nevans / gist:51068
Created January 23, 2009 16:31 — forked from pjb3/gist:50340
# 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)