From 7294c5499c56ac31713c33e1723d3f001b2905ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 3 Mar 2013 15:28:55 -0800 Subject: [PATCH] Simplify Base.readNamed() methods. --- src/core/Base.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/core/Base.js b/src/core/Base.js index 846bebc9..fe5f1809 100644 --- a/src/core/Base.js +++ b/src/core/Base.js @@ -231,9 +231,7 @@ this.Base = Base.inject(/** @lends Base# */{ */ readNamed: function(list, name) { var value = this.getNamed(list, name); - // value is undefined if there is no arguments object, and null - // if there is one, but no value is defined. - return this.read(value !== undefined ? [value] : list); + return this.read(value != null ? [value] : list); }, /** @@ -246,13 +244,9 @@ this.Base = Base.inject(/** @lends Base# */{ var arg = list[0]; if (list._hasObject === undefined) list._hasObject = list.length === 1 && Base.isPlainObject(arg); - if (list._hasObject) { + if (list._hasObject) // Return the whole arguments object if no name is provided. - value = name ? arg[name] : arg; - // Convert undefined to null, to distinguish from undefined - // result, when there is no arguments object. - return value !== undefined ? value : null; - } + return name ? arg[name] : arg; }, /**