From f760dbc6e39e098496f25a5c4ee90855a2bb3bd5 Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Sun, 8 May 2022 22:12:06 -0500 Subject: [PATCH] perf(init.js): string.match -> regex.test for node version --- src/commands/init.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/commands/init.js b/src/commands/init.js index 4dc0198..621b9ce 100644 --- a/src/commands/init.js +++ b/src/commands/init.js @@ -22,8 +22,7 @@ export async function init({ flags }) { process.exit(0); } const node = await execa('node', ['--version']); - - if (node.stdout.match(/v1(([0-6]\.[2-9])|([0-5]\.[0-9]))/gm)?.length) { + if ((/v1(([0-6]\.[2-9])|([0-5]\.[0-9]))/gm).test(node.stdout)) { console.log( yellowBright( `\nYou are using Node ${node.stdout}\nPlease upgrade to Node 16.10.x or higher!\n`