Function: Convert a Properties Object to an Array of Properties

by Simon Sparks · 1 November 2025

To use this function add it to the class library file named Utilities.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: Utilities.ts

Description: Orchestrator Function to Convert a Properties Object to an Array of Properties

Function ConvertPropertiesToArrayOfProperties

public static ConvertPropertiesToArrayOfProperties(objPropertiesInput: Properties): Properties[] {

  let arrPropertiesOutput: Properties[] = [];

  let arrKey: string[] = objPropertiesInput.keys;

  arrKey.forEach((strKey: string): void => {

    let strValue: string = objPropertiesInput.get(strKey);

    let objPropertiesOutput: Properties = new Properties()
    objPropertiesOutput.put("value", strKey);
    objPropertiesOutput.put("label", strValue);

    arrPropertiesOutput.push(objPropertiesOutput);

  });

  return arrPropertiesOutput;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like