21 lines
495 B
Plaintext
21 lines
495 B
Plaintext
----------------------------------------
|
|
-- One of the five native iterative methods defined in ECMAScript 5
|
|
-- @param {list} tList
|
|
-- @param {symbol} cbFunc
|
|
-- @param {object} [cbObj=_movie]
|
|
-- @return {list}
|
|
----------------------------------------
|
|
on map (tList, cbFunc, cbObj)
|
|
if voidP(cbObj) then cbObj = _movie
|
|
res = []
|
|
cnt = tList.count
|
|
repeat with i = 1 to cnt
|
|
res[i] = call(cbFunc, cbObj, tList[i], i, tList)
|
|
end repeat
|
|
return res
|
|
end
|
|
|
|
on doubleInt (n)
|
|
return n*2
|
|
end
|