Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
_.isURL() #underscore #mixin #cc
_.mixin({
// - Checks if a string is a full URL
// Source: https://gist.github.com/tracend/a522e5a169aad662fa80
isURL: function ( url ) {
// prerequisite
if( typeof url != "string" ) return false;
//
return ( url.substr(0, 4) == "http" || url.substr(0, 2) == "//" );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment