X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FUtils.ts;h=9a06c64ed5658e01e7409bb38ae95baaba61be5c;hb=f223daa52d37f83d11ef1b4b6864eb8b549652a4;hp=9d021ecb2d3773cfeb318f5bbf07e53d55f41a90;hpb=48847bc0d5e594c3e4c0b81c580ac6df48052668;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 9d021ecb..9a06c64e 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -328,6 +328,9 @@ export const getWebSocketCloseEventStatusString = (code: number): string => { } export const isArraySorted = (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