Merge branch 'main' into issue39-ocpp2
[e-mobility-charging-stations-simulator.git] / src / utils / Utils.ts
index 9d021ecb2d3773cfeb318f5bbf07e53d55f41a90..9a06c64ed5658e01e7409bb38ae95baaba61be5c 100644 (file)
@@ -328,6 +328,9 @@ export const getWebSocketCloseEventStatusString = (code: number): string => {
 }
 
 export const isArraySorted = <T>(array: T[], compareFn: (a: T, b: T) => number): boolean => {
+  if (array.length <= 1) {
+    return true
+  }
   for (let index = 0; index < array.length - 1; ++index) {
     if (compareFn(array[index], array[index + 1]) > 0) {
       return false