mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-27 05:57:04 +00:00
NEW CPArray -arrayByApplyingBlock:(Function/*element, index*/)aBlock
Test for CPArray -arrayByApplyingBlock:
This commit is contained in:
@@ -233,6 +233,19 @@ var concat = Array.prototype.concat,
|
||||
return join.call(self, aString);
|
||||
}
|
||||
|
||||
- (CPArray)arrayByApplyingBlock:(Function/*element, index*/)aFunction
|
||||
{
|
||||
var result = [];
|
||||
|
||||
for (var idx = 0; idx < self.length; idx++)
|
||||
{
|
||||
var obj = aFunction(self[idx], idx);
|
||||
result.push(obj);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)insertObject:(id)anObject atIndex:(CPUInteger)anIndex
|
||||
{
|
||||
if (anIndex > self.length || anIndex < 0)
|
||||
@@ -335,7 +348,6 @@ var concat = Array.prototype.concat,
|
||||
[super addObjectsFromArray:anArray];
|
||||
}
|
||||
|
||||
|
||||
- (id)copy
|
||||
{
|
||||
return slice.call(self, 0);
|
||||
|
||||
Reference in New Issue
Block a user