Files
ueblueprint/js/decoding/pinTitle.js
barsdeveloper 365732a99c WIP
2024-12-03 22:15:17 +02:00

17 lines
602 B
JavaScript
Executable File

import Utility from "../Utility.js"
/** @param {PinEntity<IEntity>} entity */
export default function pinTitle(entity) {
let result = entity.PinFriendlyName
? entity.PinFriendlyName.toString()
: Utility.formatStringName(entity.PinName?.toString() ?? "")
let match
if (match = entity.PinToolTip?.toString().match(/\s*(.+?(?=\n)|.+\S)\s*/)) {
if (match[1].toLowerCase() === result.toLowerCase()) {
return match[1] // In case they match, then keep the case of the PinToolTip
}
}
result = result.replace(/^Module\./, "")
return result
}