Created
August 19, 2014 12:36
-
-
Save hanssens/e0b215f381940be63a0e to your computer and use it in GitHub Desktop.
Globals.js - Provides generic global functions, helpers and extensions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Globals.js - Provides generic global functions, helpers and extensions. | |
*/ | |
/* | |
* Function: isNullOrEmpty() | |
* @value: determines if the object is null, empty or undefined. | |
*/ | |
function isNullOrEmpty(value) { | |
return (value == null || value == "" || value == "undefined"); | |
} | |
/* | |
* Function: isNotNullOrEmpty() | |
* @value: determines if the object is not null, not empty or not undefined. | |
*/ | |
function isNotNullOrEmpty(value) { | |
return !isNullOrEmpty(value); | |
} | |
/* | |
* Function: random() | |
* @items: accepts any collection of items | |
*/ | |
function random(items) { | |
return items[Math.floor(Math.random() * items.length)]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment