Skip to content

Commit 4ea0485

Browse files
committed
fix: simplify string formatting
1 parent 34b8cc4 commit 4ea0485

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/metadata/src/decorator-factory.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,18 @@ export class DecoratorFactory<
146146
let name =
147147
target instanceof Function
148148
? target.name
149-
: target.constructor.name + '.prototype';
149+
: `${target.constructor.name}.prototype`;
150150
if (member == null && descriptorOrIndex == null) {
151-
return 'class ' + name;
151+
return `class ${name}`;
152152
}
153153
if (member == null) member = 'constructor';
154154
if (typeof descriptorOrIndex === 'number') {
155155
// Parameter
156-
name = name + '.' + member.toString() + '[' + descriptorOrIndex + ']';
156+
name = `${name}.${member}[${descriptorOrIndex}]`;
157157
} else if (descriptorOrIndex != null) {
158-
name = name + '.' + member.toString() + '()';
158+
name = `${name}.${member}()`;
159159
} else {
160-
name = name + '.' + member.toString();
160+
name = `${name}.${member}`;
161161
}
162162
return name;
163163
}
@@ -627,7 +627,7 @@ export class MethodParameterDecoratorFactory<T> extends DecoratorFactory<
627627
);
628628
// Fetch the cached parameter index
629629
let index = Reflector.getOwnMetadata(
630-
this.key + ':index',
630+
`${this.key}:index`,
631631
target,
632632
methodName,
633633
);
@@ -667,7 +667,7 @@ export class MethodParameterDecoratorFactory<T> extends DecoratorFactory<
667667
}
668668
// Cache the index to help us position the next parameter
669669
Reflector.defineMetadata(
670-
this.key + ':index',
670+
`${this.key}:index`,
671671
index - 1,
672672
target,
673673
methodName,
@@ -691,7 +691,7 @@ export class MethodParameterDecoratorFactory<T> extends DecoratorFactory<
691691
ownMetadata[methodName!] = params;
692692
// Cache the index to help us position the next parameter
693693
Reflector.defineMetadata(
694-
this.key + ':index',
694+
`${this.key}:index`,
695695
index - 1,
696696
target,
697697
methodName,

0 commit comments

Comments
 (0)