# Module: ol/array

This documentation is for OpenLayers v10.9.0. The latest is v.

## ol/array

    import * as olArray from 'ol/array';

### Functions

#### stableSort(arr, compareFnc)

array.js, line 213

      import {stableSort} from 'ol/array';

  Sort the passed array such that the relative order of equal elements is preserved. See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details.

  Name | Type | Description
  --- | --- | ---
  `arr` | Array.<*> | The array to sort (modifies original).
  `compareFnc` | function | Comparison function.

  Deprecated
    - Yes

### Type Definitions

#### NearestDirectionFunction()

array.js, line 63

  `getZForResolution` can use a function of this type to determine which nearest resolution to use.

  This function takes a `{number}` representing a value between two array entries, a `{number}` representing the value of the nearest higher entry and a `{number}` representing the value of the nearest lower entry as arguments and returns a `{number}`. If a negative number or zero is returned the lower value will be used, if a positive number is returned the higher value will be used.