Skip to content

Instantly share code, notes, and snippets.

@newmanbrad
Created December 21, 2016 16:29
Show Gist options
  • Save newmanbrad/c0621e149cf33360d52f67704e876ee8 to your computer and use it in GitHub Desktop.
Save newmanbrad/c0621e149cf33360d52f67704e876ee8 to your computer and use it in GitHub Desktop.
Check if sub-strings are in an array of strings.
function inArray(arr1, arr2) {
return arr1.filter(function(needle) {
return arr2.some(function(haystack) {
return haystack.indexOf(needle) > -1;
});
}).sort();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment