Skip to content

Commit 005d16f

Browse files
refactor(nestjs) remove uncessary map calls
1 parent 5812078 commit 005d16f

6 files changed

Lines changed: 172 additions & 147 deletions

File tree

packages/common/interfaces/nest-express-application.interface.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as express from 'express';
21
import { ServeStaticOptions } from './external/serve-static-options.interface';
32

43
export interface INestExpressApplication {
@@ -41,9 +40,7 @@ export interface INestExpressApplication {
4140
* @returns {this}
4241
*/
4342
useStaticAssets(options: any): this;
44-
useStaticAssets(path: string, options?: ServeStaticOptions);
45-
// tslint:disable-next-line:unified-signatures
46-
useStaticAssets(pathOrOptions: any, options?: ServeStaticOptions): this;
43+
useStaticAssets(path: string, options?: ServeStaticOptions): this;
4744

4845
/**
4946
* Sets a base directory for templates (views).

packages/core/middleware/container.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class MiddlewareContainer {
2525
const currentConfig = this.getCurrentConfig(module);
2626

2727
const configurations = configList || [];
28-
configurations.map(config => {
28+
configurations.forEach(config => {
2929
[].concat(config.middleware).map(metatype => {
3030
const token = metatype.name;
3131
middleware.set(token, {

packages/core/router/router-explorer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class RouterExplorer {
127127
module: string,
128128
basePath: string,
129129
) {
130-
(routePaths || []).map(pathProperties => {
130+
(routePaths || []).forEach(pathProperties => {
131131
const { path, requestMethod } = pathProperties;
132132
this.applyCallbackToRouter(
133133
router,

packages/core/scanner.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class DependenciesScanner {
128128
metadata.PROVIDERS as 'providers',
129129
),
130130
];
131-
components.map(component => {
131+
components.forEach(component => {
132132
this.storeComponent(component, token);
133133
this.reflectComponentMetadata(component, token);
134134
this.reflectDynamicMetadata(component, token);
@@ -147,7 +147,7 @@ export class DependenciesScanner {
147147
metadata.CONTROLLERS as 'controllers',
148148
),
149149
];
150-
routes.map(route => {
150+
routes.forEach(route => {
151151
this.storeRoute(route, token);
152152
this.reflectDynamicMetadata(route, token);
153153
});
@@ -172,14 +172,14 @@ export class DependenciesScanner {
172172
metadata.EXPORTS as 'exports',
173173
),
174174
];
175-
exports.map(exportedComponent =>
175+
exports.forEach(exportedComponent =>
176176
this.storeExportedComponent(exportedComponent, token),
177177
);
178178
}
179179

180180
public reflectGatewaysMiddleware(component: Type<Injectable>, token: string) {
181181
const middleware = this.reflectMetadata(component, GATEWAY_MIDDLEWARES);
182-
middleware.map(ware => this.storeComponent(ware, token));
182+
middleware.forEach(ware => this.storeComponent(ware, token));
183183
}
184184

185185
public reflectInjectables(
@@ -202,7 +202,7 @@ export class DependenciesScanner {
202202
...flattenMethodsInjectables,
203203
].filter(isFunction);
204204

205-
mergedInjectables.map(injectable =>
205+
mergedInjectables.forEach(injectable =>
206206
this.storeInjectable(injectable, token),
207207
);
208208
}

packages/testing/testing-module.builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class TestingModuleBuilder {
9090
}
9191

9292
private applyOverloadsMap() {
93-
[...this.overloadsMap.entries()].map(([component, options]) => {
93+
[...this.overloadsMap.entries()].forEach(([component, options]) => {
9494
this.container.replace(component, options);
9595
});
9696
}

0 commit comments

Comments
 (0)