repositories
/
e-mobility-charging-stations-simulator.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b8e3363
)
perf: add fastpath in array sorting helper
author
Jérôme Benoit
<jerome.benoit@piment-noir.org>
Sat, 8 Jun 2024 16:57:16 +0000
(18:57 +0200)
committer
Jérôme Benoit
<jerome.benoit@piment-noir.org>
Sat, 8 Jun 2024 16:57:16 +0000
(18:57 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/utils/Utils.ts
patch
|
blob
|
blame
|
history
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 => {
+ 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