From 117609e7068ce35d0bd54e516729e1ada0d07c46 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Thu, 6 Jun 2024 21:32:18 +0200 Subject: [PATCH] chore(node): Make a function an expression Shorten code a bit. Signed-off-by: Sebastian Schuberth --- plugins/package-managers/node/src/main/kotlin/Yarn2.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/package-managers/node/src/main/kotlin/Yarn2.kt b/plugins/package-managers/node/src/main/kotlin/Yarn2.kt index dd3cb382e1135..e78c873ae4fbb 100644 --- a/plugins/package-managers/node/src/main/kotlin/Yarn2.kt +++ b/plugins/package-managers/node/src/main/kotlin/Yarn2.kt @@ -149,11 +149,10 @@ class Yarn2( * Check whether Corepack is enabled based on the `package.json` file in [workingDir]. If no such file is found * or if it cannot be read, assume that this is not the case. */ - private fun isCorepackEnabledInManifest(workingDir: File): Boolean { - return runCatching { + private fun isCorepackEnabledInManifest(workingDir: File): Boolean = + runCatching { jsonMapper.readTree(workingDir.resolve(MANIFEST_FILE)).contains(PACKAGE_MANAGER_PROPERTY) }.getOrDefault(false) - } } class Factory : AbstractPackageManagerFactory("Yarn2") {