You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2012/12/03 19:29:26 UTC
[3/6] git commit: Treat an empty array as blank (to more cleanly
handle required check for a Palette)
Treat an empty array as blank (to more cleanly handle required check for a Palette)
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/c95128a0
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/c95128a0
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/c95128a0
Branch: refs/heads/5.4-js-rewrite
Commit: c95128a01b8623e3383f45010c204e036b3e95e1
Parents: 969acaa
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Dec 3 10:20:02 2012 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Dec 3 10:20:02 2012 -0800
----------------------------------------------------------------------
.../META-INF/modules/core/utils.coffee | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/c95128a0/tapestry-core/src/main/coffeescript/META-INF/modules/core/utils.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/core/utils.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/core/utils.coffee
index aa264fc..89eba85 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/core/utils.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/core/utils.coffee
@@ -26,7 +26,15 @@ define ["_"], (_) ->
exports =
# Trims leading and trailing whitespace from a string. Delegates to String.prototype.trim if present.
trim: trim
- isBlank: (input) -> input is null or (exports.trim input).length == 0
+ # Determines if the input is a blank string, or null, or an empty array.
+ isBlank: (input) ->
+
+ return true if input is null
+
+ if _.isArray input
+ return input.length is 0
+
+ return (exports.trim input).length is 0
# Splits the input string into words separated by whitespace
split: (str) -> _(str.split " ").reject((s) -> s is "")