Function: Sort an Array of Properties using International Locale

by Simon Sparks · 29 January 2026

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 sortArrayOfPropertiesLocale

Description: Orchestrator Function to Sort an Array of Properties using International Locale

public static sortArrayOfPropertiesLocale(arrProperties: Properties[], , enumSortOrder: SortOrder = SortOrder.Forward): Properties[] {

  arrProperties = arrProperties.sort((objPropertiesA: Properties, objPropertiesB: Properties): number => {

    let strA: string = objPropertiesA.get<string>("label");
    let strB: string = objPropertiesB.get<string>("label");

    return this.compareTwoStringLocale(strA, strB, enumSortOrder);
  });

  return arrProperties;
}

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.

You may also like