Skip to content

Commit

Permalink
Add basic unit tests for ints, phase 6
Browse files Browse the repository at this point in the history
  • Loading branch information
gendelbendel committed May 9, 2023
1 parent 06f2534 commit 0b6caa8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/util.js
Expand Up @@ -4,15 +4,15 @@
* @returns true if array is sorted highest to lowest, false otherwise
*/
const isSortedHiToLow = (arr) =>
arr.every((val, index, arr) => !index || arr[index - 1] > val);
arr.every((val, index, arr) => !index || arr[index - 1] >= val);

/**
*
* @param {any[]} arr array of values to check
* @returns true if array is sorted lowest to highest, false otherwise
*/
const isSortedLowToHi = (arr) =>
arr.every((val, index, arr) => !index || arr[index - 1] < val);
arr.every((val, index, arr) => !index || arr[index - 1] <= val);

module.exports = {
isSortedHiToLow,
Expand Down

0 comments on commit 0b6caa8

Please sign in to comment.