Skip to content

Commit

Permalink
Add Affix Check for Object Name (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
pri-kise authored Dec 20, 2024
1 parent b1f03f8 commit bd119c9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/NAVObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,23 @@ export class NAVObject {
private AddPrefixAndSuffixToObjectNameFixed(objectName: string): string {
let prefix = this._workSpaceSettings[Settings.ObjectNamePrefix];
let suffix = this._workSpaceSettings[Settings.ObjectNameSuffix];
if (!prefix && !suffix) { return objectName }
let affixes = this._workSpaceSettings[Settings.MandatoryAffixes];
let affixesDefined = Array.isArray(affixes) && (affixes.length > 0);

if (!prefix && !suffix && !affixesDefined) { return objectName }

if (affixesDefined) {
var affixNeeded = true;
affixes.forEach((affix: string) => {
if (objectName.startsWith(affix) || objectName.endsWith(affix)) {
affixNeeded = false;
return
}
});
if (!affixNeeded) {
return objectName;
}
}

if (prefix && !objectName.startsWith(prefix)) {
objectName = prefix + objectName;
Expand Down

0 comments on commit bd119c9

Please sign in to comment.