Telogis.GeoBase.Arrays |
A namespace enclosing GeoBase functions for manipulating arrays. Normally, these would be attached to the Array prototype, but this is avoided to maintain compatibility with some other libraries.
Name | Description |
---|---|
contains (Array arr, Object item) | Checks to see whether a given array contains a certain item. Arguments
Boolean - True if Arrays.contains.item is an entry in Arrays.contains.arr; false otherwise. |
count (Array arr) | Finds the number of items in an array (or object) using hasOwnProperty(), such that in the case of sparse arrays, the actual number of elements in the array is returned. Arguments
Number - The number of non-prototyped properties of the array. |
indexOf (Array arr, Object item) | Finds the index of a certain item in an array. Arguments
Number - The index of Arrays.indexOf.item in Arrays.indexOf.arr, or -1 if no match was found. |
intersection (Array ...) | Finds the intersection of multiple arrays. Arguments
Array - An array / set containing only the elements found in each of the argument arrays. |
move (Array arr, Number from, Number to) | Moves an entry of an array from a specified index to another. The supplied array instance is not modified in the call. Arguments
Array - The modified array. |
place (Array arr, Object item, Function comparator) | Assuming the array is already sorted by Arrays.place.comparator, inserts a new item in the array at the appropriate location. If there are multiple appropriate locations, the first is used. The supplied instance of the array is not modified. Arguments
Array - The modified array. |
query (Array arr, Function condition) | Finds the index of the first item in the array to satisfy a certain condition. Arguments
Number - The index of the first item satisfying Arrays.query.condition in Arrays.query.arr, or -1 if no match was found. |
search (Array arr, Object item, Function comparator) | Performs a binary search on a sorted array to check which index a new item should be inserted at to maintain the order specified by Arrays.search.comparator. Arguments
Number - The index that the new item should be inserted at to maintain order. |
swap (Array arr, Number i, Number j) | Exchanges two values in an array. The supplied array instance is not modified during the call. Arguments
Array - The modified array. |
toSet (Array arr) | Finds a set corresponding to a given array -- i.e. that array with duplicate values removed. Arguments
Array - The set representation of the array. |
toString (Array arr) | Finds a string representation of an array. Arguments
String - A string of the form '[a1, a2, ..., an]'. |