Allow read() methods to receive an optional length parameter.

This commit is contained in:
Jürg Lehni 2011-03-03 13:15:55 +00:00
parent ecbd52cdf7
commit 3a46ac3b54
6 changed files with 12 additions and 12 deletions

View file

@ -477,8 +477,8 @@ var Point = Base.extend({
return point;
},
read: function(args, index) {
var index = index || 0, length = args.length - index;
read: function(args, index, length) {
var index = index || 0, length = length || args.length - index;
if (length == 1 && args[index] instanceof Point) {
return args[index];
} else if (length != 0) {

View file

@ -285,8 +285,8 @@ Rectangle = Base.extend({
},
statics: {
read: function(args, index) {
var index = index || 0, length = args.length - index;
read: function(args, index, length) {
var index = index || 0, length = length || args.length - index;
if (length == 1 && args[index] instanceof Rectangle) {
return args[index];
} else if (length != 0) {

View file

@ -94,8 +94,8 @@ var Size = Base.extend({
},
statics: {
read: function(args, index) {
var index = index || 0, length = args.length - index;
read: function(args, index, length) {
var index = index || 0, length = length || args.length - index;
if (length == 1 && args[index] instanceof Size) {
return args[index];
} else if (length != 0) {

View file

@ -31,8 +31,8 @@ Color = Base.extend({
},
statics: {
read: function(args, index) {
var index = index || 0, length = args.length - index;
read: function(args, index, length) {
var index = index || 0, length = length || args.length - index;
if (length == 1 && args[index] instanceof Color) {
return args[index];
} else if (length != 0 && args[0] !== null) {

View file

@ -4,8 +4,8 @@ Curve = Base.extend({
statics: {
read: function(args, index) {
var index = index || 0, length = args.length - index;
read: function(args, index, length) {
var index = index || 0, length = length || args.length - index;
if (length == 1 && args[index] instanceof Curve) {
return args[index];
} else if (length != 0) {

View file

@ -121,8 +121,8 @@ Segment = Base.extend({
},
statics: {
read: function(args, index) {
var index = index || 0, length = args.length - index;
read: function(args, index, length) {
var index = index || 0, length = length || args.length - index;
if (length == 1 && args[index] instanceof Segment) {
return args[index];
} else if (length != 0) {