]> git.ardis.lu - envpass/commitdiff
Apply type narrowing to `decrypt`
authorArdis Lu <ardisglu@gmail.com>
Fri, 24 Jul 2026 07:08:55 +0000 (00:08 -0700)
committerArdis Lu <ardisglu@gmail.com>
Fri, 24 Jul 2026 07:08:55 +0000 (00:08 -0700)
Same logic applies, just forgot to do this in 8374efadfc751aa2a5db43cff96109ffb230690b

src/command.js

index 454e06f110bab607dd3d2e9d8663dfd462515733..b4d497398f447edcf39deab8c5d2354aafc4a93c 100644 (file)
@@ -121,6 +121,7 @@ export async function decrypt(options = {}, { args = [] } = {}) {
     logger = {}
   } = options;
 
+  /** @type {Record<string, string>} */
   const env = await readFile(inFile, { encoding: 'utf-8' }).then(parseEnv);
   logger.debug?.('Environment variables read and parsed.');
   if (Object.keys(env).length === 0) {
@@ -131,12 +132,6 @@ export async function decrypt(options = {}, { args = [] } = {}) {
   let prf = null;
   /** @type {Env} */const decryptedEnv = {};
   for (const [envVar, value] of Object.entries(env)) {
-    if (value === undefined) {
-      logger.info?.(`Environment variable "${envVar}" is unset, skipping decryption.`);
-      decryptedEnv[envVar] = '';
-      continue;
-    }
-
     const parsedValue = parseEnvpassEncrypted(value);
     if (parsedValue === null) {
       decryptedEnv[envVar] = value;
This page took 0.041519 seconds and 4 git commands to generate.