note:sun_jun_22_2025

Code Formatter

type LowcodeInterface = {
  identifier: string;
  fields: { name: string, type: string, comment?: string }[];
  comment?: string;
}

function printField(field: { name: string, type: string, comment?: string }) {
  return (field.comment ? '  /* ' + field.comment + ' */' + "\n" : "")
          + "  " + field.name + ": " + field.type;
}

function printInterface(lowcodeInterface: LowcodeInterface) {
  return (lowcodeInterface.comment ? '/* ' + lowcodeInterface.comment + " */\n" : "")
          + "interface " + lowcodeInterface.identifier + " {\n"
          + lowcodeInterface.fields.map(printField).join('\n') 
          + "\n}";
}

export { printInterface };  

  • note/sun_jun_22_2025.txt
  • Last modified: 2025/06/22 14:52
  • by lingao