diff options
author | wycats <wycats@gmail.com> | 2010-12-03 01:39:00 -0500 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-12-03 01:39:00 -0500 |
commit | 9a6f77af568d387d66d7cf1dcf6e4ea186d05506 (patch) | |
tree | 98997529fdcb426d3331f1f096aa854a0a90ed40 /lib/handlebars/utils.js | |
parent | c89ecf80a5dbc6f231ce9c74ff860bd1c6f3b478 (diff) | |
download | handlebars.js-9a6f77af568d387d66d7cf1dcf6e4ea186d05506.zip handlebars.js-9a6f77af568d387d66d7cf1dcf6e4ea186d05506.tar.gz handlebars.js-9a6f77af568d387d66d7cf1dcf6e4ea186d05506.tar.bz2 |
A few more lingering bugs:
* add helperMissing.not to the specs
* add Handlebars.Utils.isEmpty
* add runtime handling for inverse sections
* fix __get__ to pass an IdNode to evaluate
* handle case in wrapProgram where context is undefined
Diffstat (limited to 'lib/handlebars/utils.js')
-rw-r--r-- | lib/handlebars/utils.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/handlebars/utils.js b/lib/handlebars/utils.js index a166598..1501d56 100644 --- a/lib/handlebars/utils.js +++ b/lib/handlebars/utils.js @@ -44,6 +44,19 @@ Handlebars.Utils = { return str; } }); + }, + isEmpty: function(value) { + if (typeof value === "undefined") { + return true; + } else if (value === null) { + return true; + } else if (value === false) { + return true; + } else if(Object.prototype.toString.call(value) === "[object Array]" && value.length == 0) { + return true; + } else { + return false; + } } } |