Utility functions for checking function parameters and throwing appropriate errors.
public static function checkArgument(expression:Boolean, message:String = null):void
Check that the specified expression is true.
Parameters
| expression:Boolean |
|
| message:String (default = null )
|
Throws
public static function checkIndex(index:int, size:int, message:String = null):int
Check that the specified index is valid: greater than or equal to 0, and less than size.
Parameters
| index:int |
|
| size:int |
|
| message:String (default = null )
|
Returns
| int — the index that was checked.
|
Throws
public static function checkNotNull(ref:*, message:String = null):*
Check that the reference is not null (or undefined) and return it as a convenience.
Parameters
| ref:* |
|
| message:String (default = null )
|
Returns
| * — the reference that was checked.
|
Throws
public static function checkRange(value:Number, low:Number, high:Number, message:String = null):Number
Check that the specified value is not NaN and between the low and high values (inclusive).
Passing NaN for low or high will disable that test.
Parameters
| value:Number |
|
| low:Number |
|
| high:Number |
|
| message:String (default = null )
|
Returns
| Number — the value that was checked.
|
Throws
Copyright © 2007-2009 Three Rings Design, Inc.