Skip to content

Instantly share code, notes, and snippets.

@codeincontext
Created May 16, 2012 15:32
Show Gist options
  • Save codeincontext/2711322 to your computer and use it in GitHub Desktop.
Save codeincontext/2711322 to your computer and use it in GitHub Desktop.
Handlebars.Utils.isEmpty = function(value) {
if (typeof value === "undefined") {
return true;
} else if (value === null) {
return true;
} else if (value === false) {
return true;
} else if (value === '') {
return true;
} else if (value === 'null') {
return true;
} else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) {
return true;
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment