From 30b7545a5a2139a26e48f5f227d023e28d0caad0 Mon Sep 17 00:00:00 2001 From: Mor Hagbi Date: Mon, 3 Jun 2024 13:08:42 +0300 Subject: [PATCH] refactor(dotnet-auth):using findIndex instead of using findIndex --- .../src/core/create-builders-services.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/dotnet-auth-core-identity/src/core/create-builders-services.ts b/plugins/dotnet-auth-core-identity/src/core/create-builders-services.ts index 6c41f3b3..1627d10c 100644 --- a/plugins/dotnet-auth-core-identity/src/core/create-builders-services.ts +++ b/plugins/dotnet-auth-core-identity/src/core/create-builders-services.ts @@ -10,12 +10,11 @@ export function createBuildersServices( }) ); - const swaggerBuilder = builderServicesBlocks.find((builder) => - builder.toString().includes("AddSwaggerGen") + const swaggerBuilderIndex = builderServicesBlocks.findIndex((b) => + b.toString().includes("AddSwaggerGen") ); - if (!swaggerBuilder) return; - const swaggerBuilderIndex = builderServicesBlocks.indexOf(swaggerBuilder); + if (swaggerBuilderIndex === -1) return; builderServicesBlocks[swaggerBuilderIndex] = new CodeBlock({ references: [