Skip to content

hasUnsortedValue

Subhajit Sahu edited this page May 3, 2023 · 1 revision

Examine if array has an unsorted value.

Similar: isSorted, hasUnsortedValue, searchUnsortedValue.


function hasUnsortedValue(x, fc, fm)
// x:  an array
// fc: compare function (a, b)
// fm: map function (v, i, x)

const xarray = require('extra-array');

var x = [1, 2, 3, 4, 5];
xarray.hasUnsortedValue(x, (a, b) => a-b);
// → false

var x = [1, 2, 8, 4, 5];
xarray.hasUnsortedValue(x, (a, b) => a-b);
// → true


References

Clone this wiki locally