Change Base.read to not return an object if only null is provided.

This commit is contained in:
Jürg Lehni 2011-03-04 19:06:05 +00:00
parent acb6e850a0
commit 101cb11973

10
lib/bootstrap.js vendored
View file

@ -201,9 +201,13 @@ new function() {
read: function(args, index, length) {
var index = index || 0, length = length || args.length - index;
if (length == 1 && args[index] instanceof this) {
return args[index];
} else if (length != 0) {
if (length == 1) {
var arg = args[index];
// Return null when only null was provided
if (arg instanceof this || arg == null)
return arg;
}
if (length > 0) {
var obj = new this(this.dont);
obj = obj.initialize.apply(obj, index > 0 || length < args.length
? Array.prototype.slice.call(args, index, index + length)