Helper function to group array elements by a criteria callback function.
npm install arr-group
npm install arr-group
``
The passed array has to be sorted reflecting the order the single items has to be checked for.
See code of group-numbers about how arr-group is used.
Arguments
---------
$3
The array to be grouped.
It has to be sorted reflecting the order the single has to be checked for.
$3
Callback that should return true if the passed current element is following the passed previous element.
``
function(currentItem, previousItem) {
[...]
return true; // current item is the following the previous item
[...]
return false; // current item is not following the previous item
}
```