mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-10 18:52:19 +00:00
add firstObject method to CPArray
This commit is contained in:
1 parent
65ce93ce42
commit
42c60913c6
1 file changed
+14
-1
@@ -205,7 +205,20 @@ var concat = Array.prototype.concat,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the last object in the array. If the array is empty, returns \c nil/
|
||||
Returns the first object in the array. If the array is empty, returns \c nil
|
||||
*/
|
||||
- (id)firstObject
|
||||
{
|
||||
var count = [self count];
|
||||
|
||||
if (count > 0)
|
||||
return [self objectAtIndex:0];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the last object in the array. If the array is empty, returns \c nil
|
||||
*/
|
||||
- (id)lastObject
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user