From 0c715a38741a92edad7795b0a0c6020d8ec320a7 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Wed, 18 Oct 2023 08:19:39 +0100 Subject: [PATCH] refactor(index): use object destructuring (#165) --- index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index ac3ce2a..2614a08 100644 --- a/index.js +++ b/index.js @@ -54,21 +54,21 @@ function envSchema (_opts) { throw error } - const schema = opts.schema + const { schema } = opts schema.additionalProperties = false - let data = opts.data - if (!Array.isArray(opts.data)) { + let { data, dotenv, env, expandEnv } = opts + if (!Array.isArray(data)) { data = [data] } - if (opts.dotenv) { - require('dotenv').config(Object.assign({}, opts.dotenv)) + if (dotenv) { + require('dotenv').config(Object.assign({}, dotenv)) } /* istanbul ignore else */ - if (opts.env) { - if (opts.expandEnv) { + if (env) { + if (expandEnv) { require('dotenv-expand').expand({ parsed: process.env }) } data.unshift(process.env)