Skip to content

Commit

Permalink
fix(functions): Fix issue #17
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Gaudek committed Dec 28, 2021
1 parent 5a79c3c commit b65ea1e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/types/action.func.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class ActionFunction extends BaseType<IActionFunctionDeclarationStructure
const result = this.createEnum(prefix);

result.members?.push(
this.createEnumField("name", this.sanitizeTarget(this.name), true)
this.createEnumField("name", this.getTarget(this.name), true)
);

if (this.def.params) {
Expand Down
14 changes: 13 additions & 1 deletion src/types/base.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,20 @@ export abstract class BaseType<O = unknown> {
* @memberof BaseType
*/
protected sanitizeTarget(target: string): string {
return this.sanitizeName(this.getTarget(target));
}

/**
* Return a target from a given target string
*
* @protected
* @param {string} target Target to sanitize
* @returns {string} Sanitized target
* @memberof BaseType
*/
protected getTarget(target: string): string {
const parts = target.split(".");
return this.sanitizeName(parts[parts.length - 1]);
return parts[parts.length - 1];
}

/**
Expand Down

0 comments on commit b65ea1e

Please sign in to comment.