deno.land / x / simplestatistic@v7.7.1 / src / extent_sorted.js

extent_sorted.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/** * The extent is the lowest & highest number in the array. With a sorted array, * the first element in the array is always the lowest while the last element is always the largest, so this calculation * can be done in one step, or constant time. * * @param {Array<number>} x input * @returns {Array<number>} minimum & maximum value * @example * extentSorted([-100, -10, 1, 2, 5]); // => [-100, 5] */function extentSorted(x) { return [x[0], x[x.length - 1]];}
export default extentSorted;
simplestatistic

Version Info

Tagged at
2 years ago