Skip to content

Commit d150650

Browse files
Merge pull request nestjs#2528 from jbpionnier/refactor_module_decorator
refactor(common): module decorator (metadata validation)
2 parents 6f6d8a4 + f3314a2 commit d150650

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

packages/common/decorators/modules/module.decorator.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ const metadataKeys = [
1010
];
1111

1212
const validateKeys = (keys: string[]) => {
13-
const isKeyInvalid = (key: string) =>
14-
metadataKeys.findIndex(k => k === key) < 0;
1513

1614
const validateKey = (key: string) => {
17-
if (!isKeyInvalid(key)) {
15+
if (metadataKeys.includes(key)) {
1816
return;
1917
}
2018
throw new InvalidModuleConfigException(key);
@@ -28,7 +26,7 @@ const validateKeys = (keys: string[]) => {
2826
* - `controllers` - the list of controllers (e.g. HTTP controllers)
2927
* - `providers` - the list of providers that belong to this module. They can be injected between themselves.
3028
* - `exports` - the set of components, which should be available for modules, which imports this module
31-
* @param options {ModuleMetadata} Module metadata
29+
* @param metadata {ModuleMetadata} Module metadata
3230
*/
3331
export function Module(metadata: ModuleMetadata): ClassDecorator {
3432
const propsKeys = Object.keys(metadata);

0 commit comments

Comments
 (0)