Skip to content

Instantly share code, notes, and snippets.

@kirs
Created April 4, 2012 19:00
Show Gist options
  • Save kirs/2304768 to your computer and use it in GitHub Desktop.
Save kirs/2304768 to your computer and use it in GitHub Desktop.
function ror_id(jObjOrString) {
var matchResult;
if ( isJQ(jObjOrString) ) {
var id = jObjOrString.data('ror_id');
if ( ! isset(id) ) {
id = jObjOrString.attr('id');
if ( isset(id) ) {
matchResult = id.match($.regexp.rorId);
id = matchResult ? matchResult[2] : '';
jObjOrString.data('ror_id', id);
} else id = '';
}
} else {
matchResult = jObjOrString.match($.regexp.rorId);
id = matchResult ? matchResult[2] : '';
}
return id;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment