• Version 11.0.6
  • Published
  • 18.2 kB
  • 1 dependency
  • BSD-2-Clause license


npm i dotenv-expand
yarn add dotenv-expand
pnpm add dotenv-expand


Expand environment variables using dotenv



function expand

expand: (options?: DotenvExpandOptions) => DotenvExpandOutput;
  • Adds variable expansion on top of dotenv.


    Parameter options

    additional options. example: { processEnv: {}, error: null, parsed: { { KEY: 'value' } }


    an object with a parsed key if successful or error key if an error occurred. example: { parsed: { KEY: 'value' } }


interface DotenvExpandOptions

interface DotenvExpandOptions {}

    property error

    error?: Error;

      property parsed

      parsed?: DotenvParseInput;
      • Default: object

        Object coming from dotenv's parsed result.

      property processEnv

      processEnv?: DotenvPopulateInput;
      • Default: process.env

        Specify an object to write your secrets to. Defaults to process.env environment variables.

        example: const processEnv = {}; require('dotenv').config({ processEnv: processEnv })

      interface DotenvExpandOutput

      interface DotenvExpandOutput {}

        property error

        error?: Error;

          property parsed

          parsed?: DotenvParseOutput;

            interface DotenvParseInput

            interface DotenvParseInput {}

              index signature

              [name: string]: string;

                interface DotenvParseOutput

                interface DotenvParseOutput {}

                  index signature

                  [name: string]: string;

                    interface DotenvPopulateInput

                    interface DotenvPopulateInput {}

                      index signature

                      [name: string]: string;

                        Package Files (1)

                        Dependencies (1)

                        Dev Dependencies (5)

                        Peer Dependencies (0)

                        No peer dependencies.


                        To add a badge like this badgeto your package's README, use the codes available below.

                        You may also use to create a custom badge linking to

                        • Markdown
                        • HTML
                          <a href=""><img src="" alt=""></a>