模块 ringo / utils /数组
提供使用 JavaScript 数组的工具函数。
Functions
contains (array, val)
检查作为参数传递的数组是否包含特定值(从数组的末尾开始)。
Parameters
| Array | array | the array |
| Object | val | the value to check |
Returns
| Boolean | true if the value is contained |
intersection (array1,...)
检索一组数组的交集。
Parameters
| Array | array1,... | the arrays to intersect |
Returns
| Array | the intersection set |
max (array)
Parameters
| Array | array | the array |
Returns
| Number | the maximal element in an array obtained by calling Math.max(). |
min (array)
Parameters
| Array | array | the array |
Returns
| Number | the minimal element in an array obtained by calling Math.min(). |
peek (array)
对象数组的最后一个元素,如果数组为空,则为 undefined。
Parameters
| Array | array | the array |
Returns
| Object | the last element of the array, or undefined if the array is empty. |
remove (array, val)
从数组中删除第一次出现的参数值。此方法会改变并返回调用它的数组,并且不会创建新的数组实例。
Parameters
| Array | array | the array |
| Object | val | the value to remove |
Returns
| Array | the array |
union (array1,...)
检索一组数组的联合集合。
Parameters
| Array | array1,... | the arrays to unify |
Returns
| Array | the union set |