Skip to content

Instantly share code, notes, and snippets.

@andreasvirkus
Created May 9, 2016 14:47
Show Gist options
  • Save andreasvirkus/346ef2f38d2f2175239e02f70b5b11b7 to your computer and use it in GitHub Desktop.
Save andreasvirkus/346ef2f38d2f2175239e02f70b5b11b7 to your computer and use it in GitHub Desktop.
/**
* Regular Expression IndexOf for Arrays
*/
if (typeof Array.prototype.reIndexOf === 'undefined') {
Array.prototype.reIndexOf = function (rx) {
for (var i in this) {
if (this[i].toString().match(rx)) {
return i;
}
}
return -1;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment