To use this function add it to the class library file named Utilities.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: Utilities.ts
Function compareTwoVariables
Description: Orchestrator Function to Compare Two Variables
publicstaticcompareTwoVariables<T>(anyA:T,anyB:T,enumSortOrder:SortOrder=SortOrder.Forward):0|1|-1{
if (enumSortOrder===SortOrder.Forward){
if (anyA<anyB){
return-1;
}elseif (anyA>anyB){
return1;
}else{
return0
}
}elseif (enumSortOrder===SortOrder.Reverse){
if (anyA<anyB){
return1;
}elseif (anyA>anyB){
return-1;
}else{
return0
}
}
}Enumeration: SortOrder
exportenumSortOrder{
Forward="Forward",
Reverse="Reverse"
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
