mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Change Base.read to not return an object if only null is provided.
This commit is contained in:
parent
acb6e850a0
commit
101cb11973
1 changed files with 7 additions and 3 deletions
10
lib/bootstrap.js
vendored
10
lib/bootstrap.js
vendored
|
@ -201,9 +201,13 @@ new function() {
|
||||||
|
|
||||||
read: function(args, index, length) {
|
read: function(args, index, length) {
|
||||||
var index = index || 0, length = length || args.length - index;
|
var index = index || 0, length = length || args.length - index;
|
||||||
if (length == 1 && args[index] instanceof this) {
|
if (length == 1) {
|
||||||
return args[index];
|
var arg = args[index];
|
||||||
} else if (length != 0) {
|
// Return null when only null was provided
|
||||||
|
if (arg instanceof this || arg == null)
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
if (length > 0) {
|
||||||
var obj = new this(this.dont);
|
var obj = new this(this.dont);
|
||||||
obj = obj.initialize.apply(obj, index > 0 || length < args.length
|
obj = obj.initialize.apply(obj, index > 0 || length < args.length
|
||||||
? Array.prototype.slice.call(args, index, index + length)
|
? Array.prototype.slice.call(args, index, index + length)
|
||||||
|
|
Loading…
Reference in a new issue