Skip to content

Instantly share code, notes, and snippets.

@alexmaze
Created April 14, 2017 03:06
Show Gist options
  • Save alexmaze/5dd7bd38e50153690a01bbe36e456e20 to your computer and use it in GitHub Desktop.
Save alexmaze/5dd7bd38e50153690a01bbe36e456e20 to your computer and use it in GitHub Desktop.
search object contents
function search(obj: Object, query: string) {
for (let key of Object.getOwnPropertyNames(obj)) {
if (RegExp(query, 'i').test(obj[key])) {
return true
}
}
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment