From 416be5513df6719e3c58de1802843bb383cf4ea3 Mon Sep 17 00:00:00 2001 From: Isaac Cerna Najera <62045266+Isaacoder95@users.noreply.github.com> Date: Wed, 26 Aug 2020 19:49:04 -0500 Subject: [PATCH] Undefined Fix Add validation to fix error undefined. --- lib/default-encoding.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/default-encoding.js b/lib/default-encoding.js index 4404fd2..5e16333 100644 --- a/lib/default-encoding.js +++ b/lib/default-encoding.js @@ -3,8 +3,9 @@ var defaultEncoding if (process.browser) { defaultEncoding = 'utf-8' } else if (process.version) { - var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10) - + if(process.version.length > 0){ + var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10) + } defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary' } else { defaultEncoding = 'utf-8'