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
public static compareTwoVariables<T>(anyA: T, anyB: T, enumSortOrder: SortOrder = SortOrder.Forward): 0 | 1 | -1 {
if (enumSortOrder === SortOrder.Forward) {
if (anyA < anyB) {
return -1;
} else if (anyA > anyB) {
return 1;
} else {
return 0
}
} else if (enumSortOrder === SortOrder.Reverse) {
if (anyA < anyB) {
return 1;
} else if (anyA > anyB) {
return -1;
} else {
return 0
}
}
}Enumeration: SortOrder
export enum SortOrder {
Forward = "Forward",
Reverse = "Reverse"
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
