Global

Methods

combine(arr1, arr2, processFunction) → {Array}

Call to processFunction wich each possible combination of elements in arr1 and arr2 and return an array with the result of each call to processFunction. ej. We have two list of coords and we want all possible combinations of points. Simple as call this functions with the list and the constructor.
Parameters:
Name Type Description
arr1 Array Unsorted array.
arr2 Array Unsorted array.
processFunction Array Two arguments function which return a new element.
Source:
Returns:
Array of elements according to description.
Type
Array

compare(srtf1, srtf2, compareFunction) → {Number}

Compared each two elements in two sorted arrays until one return non sero value.
Parameters:
Name Type Description
srtf1 Array SortFilter Array.
srtf2 Array SortFilter Array.
compareFunction Funcion Two argument function that return a number minor, equal or bigger than 0.
Source:
Returns:
A number minor, equal or bigger than 0 according to description.
Type
Number

equal(srtf1, srtf2, compareFunction) → {Bool}

Compare two sorted array
Parameters:
Name Type Description
srtf1 Array SortFilter Array.
srtf2 Array SortFilter Array.
compareFunction Funcion Two argument function that return a number minor, equal or bigger than 0.
Source:
Returns:
Return true if succeed or false other way.
Type
Bool

exclusion(srtf1, srtf2, compareFunction)

New SortFilter Array with elements of srtf1 which are not duplicated in srtf2.
Parameters:
Name Type Description
srtf1 Array , SortFilter Array.
srtf2 Array , SortFilter Array.
compareFunction Funcion Two argument function that return a number minor, equal or bigger than 0.
Source:

intersection(srtf1, srtf2, compareFunction) → {Array}

New SortFilter Array with elements duplicated in both Arrays, by duplicate means compare function return 0.
Parameters:
Name Type Description
srtf1 Array , SortFilter Array.
srtf2 Array , SortFilter Array.
compareFunction Funcion Two argument function that return a number minor, equal or bigger than 0.
Source:
Returns:
New Array of elements according to description.
Type
Array

mutualExclusion(srtf1, srtf2, compareFunction)

New SortFilter Array with elements of srtf1 which are not duplicated in srtf2 and elements of srtf2 which are not duplicated in srtf1.
Parameters:
Name Type Description
srtf1 Array , SortFilter Array.
srtf2 Array , SortFilter Array.
compareFunction Funcion Two argument function that return a number minor, equal or bigger than 0.
Source:

removeEquals(srtf, compareFunction) → {Array}

Compare contiguous elemented and remove the second if the compare function return any value different than 0. This method is usual used to remove repeated elements in a previously sorted Array.
Parameters:
Name Type Description
srtf Array SortFilter Array.
compareFunction Funcion Two argument function that return a number minor, equal or bigger than 0.
Source:
Returns:
New Array of elements according to description.
Type
Array

sliceFind(srtf, value, compareFunction) → {Array}

New Array starting from first index where compare function return 0 or positive numeber.
Parameters:
Name Type Description
srtf Array , SortFilter Array.
value *
compareFunction Funcion Two argument function that return a number minor, equal or bigger than 0.
Source:
Returns:
New Array of elements according to description.
Type
Array

sort(array, compareFunction) → {Array}

Same as Array.sort with the addition that is retuning a new Array.
Parameters:
Name Type Description
array Array
compareFunction Funcion Two argument function that return a number minor, equal or bigger than 0.
Source:
Returns:
New Array of elements according to description.
Type
Array

sortFilter(array, compareFunction) → {Array}

Sort Array and then remove equal contiguos elements in both cases using compare function.
Parameters:
Name Type Description
array Array
compareFunction Funcion Two argument function that return a number minor, equal or bigger than 0.
Source:
Returns:
New Array of elements according to description.
Type
Array

union(srtf1, srtf2, compareFunction) → {Array}

SortFilter Array of values in both sorted arrays without repeating values.
Parameters:
Name Type Description
srtf1 Array SortFilter Array.
srtf2 Array SortFilter Array.
compareFunction Funcion Two argument function that return a number minor, equal or bigger than 0.
Source:
Returns:
New Array of elements according to description.
Type
Array