mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-12 03:27:07 +00:00
NEW CPArray -arrayByApplyingBlock:(Function/*element, index*/)aBlock
Test for CPArray -arrayByApplyingBlock:
This commit is contained in:
1 parent
8403e36d4d
commit
08aa591c65
3 files changed
+45
-1
No files matched your search
@@ -880,6 +880,21 @@ Returns a hash for the object. Unlike Cocoa, the hash value does not take conten
|
||||
return join.call([self _javaScriptArrayCopy], aString);
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (CPArray)arrayByApplyingBlock:(Function/*element, index*/)aFunction
|
||||
{
|
||||
var result = [],
|
||||
count = [self count];
|
||||
|
||||
for (var idx = 0; idx < count; idx++)
|
||||
{
|
||||
var obj = aFunction([self objectAtIndex:idx], idx);
|
||||
[result addObject:obj];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Creating a description of the array
|
||||
|
||||
/*!
|
||||
|
||||
Reference in new issue
Block a user