repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'main' into issue39-ocpp2
[e-mobility-charging-stations-simulator.git]
/
src
/
utils
/
Utils.ts
diff --git
a/src/utils/Utils.ts
b/src/utils/Utils.ts
index 9d021ecb2d3773cfeb318f5bbf07e53d55f41a90..9a06c64ed5658e01e7409bb38ae95baaba61be5c 100644
(file)
--- a/
src/utils/Utils.ts
+++ b/
src/utils/Utils.ts
@@
-328,6
+328,9
@@
export const getWebSocketCloseEventStatusString = (code: number): string => {
}
export const isArraySorted = <T>(array: T[], compareFn: (a: T, b: T) => number): boolean => {
}
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
for (let index = 0; index < array.length - 1; ++index) {
if (compareFn(array[index], array[index + 1]) > 0) {
return false