UNPKG

array-sorted

Version:

check an array is sorted or not.

53 lines (52 loc) 727 B
[ { "array": [], "sorted": true }, { "array": [5], "sorted": true }, { "array": [3, 8], "sorted": true }, { "array": [2, 2.5, 8], "sorted": true }, { "array": [9, 8, 7, 6], "customCompare": "LargerToSmaller", "sorted": true }, { "array": ["a", "b", "c"], "sorted": true }, { "array": ["a", "m", "c"], "sorted": false }, { "array": ["a", "M", "m"], "sorted": false }, { "array": ["a", "M", "c"], "sorted": false }, { "array": ["ab", "ac", "ad"], "sorted": true }, { "array": ["ad", "ac", "ab"], "customCompare": "LargerToSmaller", "sorted": true }, { "array": ["ab", "aM", "cb"], "sorted": false } ]