Skip to content

Instantly share code, notes, and snippets.

@andersr
Created November 4, 2016 16:09
Show Gist options
  • Save andersr/7ccf8928a67646dfed9719377458ad34 to your computer and use it in GitHub Desktop.
Save andersr/7ccf8928a67646dfed9719377458ad34 to your computer and use it in GitHub Desktop.
Example of namespaced global variable
var utils = {
isEmpty: function (str) {
return str.trim().length === 0
},
isEmail: function (email) {
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/
return regex.test(email)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment