{"id":13903229,"url":"https://github.com/ladjs/dotenv-parse-variables","last_synced_at":"2026-03-17T11:34:10.930Z","repository":{"id":54530391,"uuid":"64563453","full_name":"ladjs/dotenv-parse-variables","owner":"ladjs","description":"Parse dotenv files for Boolean, Array, and Number variable types, built for Lad","archived":false,"fork":false,"pushed_at":"2021-02-12T18:33:33.000Z","size":301,"stargazers_count":125,"open_issues_count":0,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-30T13:08:58.319Z","etag":null,"topics":["config","dotenv","dotfile","env","environment","factor","parse","twelve","variables","vars"],"latest_commit_sha":null,"homepage":"https://lad.js.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ladjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"niftylettuce","patreon":"niftylettuce"}},"created_at":"2016-07-30T20:47:36.000Z","updated_at":"2025-05-18T09:54:08.000Z","dependencies_parsed_at":"2022-08-13T18:50:35.464Z","dependency_job_id":null,"html_url":"https://github.com/ladjs/dotenv-parse-variables","commit_stats":null,"previous_names":["niftylettuce/dotenv-parse-variables"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/ladjs/dotenv-parse-variables","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fdotenv-parse-variables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fdotenv-parse-variables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fdotenv-parse-variables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fdotenv-parse-variables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ladjs","download_url":"https://codeload.github.com/ladjs/dotenv-parse-variables/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fdotenv-parse-variables/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30622757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T11:26:08.186Z","status":"ssl_error","status_checked_at":"2026-03-17T11:24:37.311Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","dotenv","dotfile","env","environment","factor","parse","twelve","variables","vars"],"created_at":"2024-08-06T22:01:53.449Z","updated_at":"2026-03-17T11:34:10.913Z","avatar_url":"https://github.com/ladjs.png","language":"JavaScript","readme":"# dotenv-parse-variables\n\n[![build status](https://travis-ci.com/niftylettuce/dotenv-parse-variables.svg)](https://travis-ci.com/niftylettuce/dotenv-parse-variables)\n[![code coverage](https://img.shields.io/codecov/c/github/niftylettuce/dotenv-parse-variables.svg)](https://codecov.io/gh/niftylettuce/dotenv-parse-variables)\n[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)\n[![license](https://img.shields.io/github/license/niftylettuce/dotenv-parse-variables.svg)](LICENSE)\n\n\u003e Parse dotenv files for `Boolean`, `Array`, and `Number` variable types, built for [Lad][] and [Forward Email][fe].\n\n\n## Table of Contents\n\n* [Install](#install)\n* [Example](#example)\n* [Usage](#usage)\n* [Options](#options)\n* [Contributors](#contributors)\n* [License](#license)\n\n\n## Install\n\n[npm][]:\n\n```sh\nnpm install dotenv-parse-variables\n```\n\n[yarn][]:\n\n```sh\nyarn add dotenv-parse-variables\n```\n\n\n## Example\n\nImagine you have a configuration file at `.env` with the following:\n\n```bash\nFOO=bar\nBAZ=2\nBEEP=false\nBOOP=some,thing,that,goes,wow\n# note how we use an asterisk here to turn off the parsing for this variable\nBLEEP=false*\n# note how we use an asterisk in the array to turn off parsing for an array key value\nPING=ping,true*,2,100\n# note a string between bacticks won't be parsed\nPONG=`some,thing,that,goes,wow`\n```\n\nAfter using this plugin, the environment variables are parsed to their proper types.\n\nTo test it out, simply log the returned object in your console:\n\n```js\nconsole.log(env);\n```\n\nAnd you'll see that it outputs the properly parsed variable types:\n\n```js\n{\n  // String\n  FOO: 'bar',\n  // Number\n  BAZ: 2,\n  // Boolean\n  BEEP: false,\n  // Array\n  BOOP: [ 'some', 'thing', 'that', 'goes', 'wow' ],\n  // NOTE: this was not parsed due to the * asterisk override above\n  BLEEP: 'false',\n  // NOTE: only the \"true*\" above was opted out through the use of an asterisk\n  PING: [ 'ping', 'true', 2, 100 ],\n  // NOTE: this was not parsed because the string was between bacticks\n  PONG: 'some,thing,that,goes,wow'\n}\n```\n\nIf your configuration line ends in `*` it will not be parsed by this package, which allows you to keep values as the `String` variable type if needed. Also when you encapsulate a value between bacticks e.g. \\`value\\`, the value won't be parsed and it will return as a `String` variable. This can be used in situations where you for example have a `,` inside your string and it should not be parsed as an array.\n\n\n## Usage\n\nThis package works well with [dotenv][dotenv], however we also recommend to use [dotenv-extended][dotenv-extended] and [dotenv-expand][dotenv-expand] as we do in [Lad][].  You could also simply just use [Lad][] or [@ladjs/env][] specifically.\n\n\u003e Example with `dotenv`:\n\n```js\nconst dotenv = require('dotenv');\nconst dotenvParseVariables = require('dotenv-parse-variables');\n\nlet env = dotenv.config({})\nif (env.error) throw env.error;\nenv = dotenvParseVariables(env.parsed);\n\nconsole.log(env);\n```\n\n\u003e Example with `dotenv-extended` (which supports a well-defined `.env` file) and `dotenv-expand` (which supports variable interpolation):\n\n```js\nconst dotenvExtended = require('dotenv-extended');\nconst dotenvMustache = require('dotenv-mustache');\nconst dotenvParseVariables = require('dotenv-parse-variables');\n\nlet env = dotenvExtended.load({\n  silent: false,\n  errorOnMissing: true,\n  errorOnExtra: true\n});\nenv = dotenvMustache(env);\nenv = dotenvParseVariables(env);\n\nconsole.log(env);\n```\n\nIf you don't want to use this package to parse variable types, you could also use [getenv][getenv] (but it requires more work).\n\n\n## Options\n\nA second argument can be provided to `dotenvParseVariables` with an object of options.\n\nThe defaults are listed below:\n\n* `assignToProcessEnv` (Boolean) - defaults to `true`, whether or not to assign the parsed values to `process.env`\n* `overrideProcessEnv` (Boolean) - defaults to `false`, whether or not to override existing values in `process.env`\n* `ignoreFunctions` (Boolean) - defaults to `true`, whether or not to ignore functions in the parsed values returned\n\n\n## Contributors\n\n| Name           | Website                   |\n| -------------- | ------------------------- |\n| **Nick Baugh** | \u003chttp://niftylettuce.com\u003e |\n\n\n## License\n\n[MIT](LICENSE) © Nick Baugh\n\n\n##\n\n[lad]: https://lad.js.org\n\n[fe]: https://forwardemail.net\n\n[npm]: https://www.npmjs.com/\n\n[yarn]: https://yarnpkg.com/\n\n[dotenv]: https://github.com/motdotla/dotenv\n\n[dotenv-expand]: https://github.com/motdotla/dotenv-expand\n\n[dotenv-extended]: https://github.com/keithmorris/node-dotenv-extended\n\n[getenv]: https://github.com/ctavan/node-getenv\n\n[@ladjs/env]: https://github.com/ladjs/env\n","funding_links":["https://github.com/sponsors/niftylettuce","https://patreon.com/niftylettuce"],"categories":["config"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fdotenv-parse-variables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fladjs%2Fdotenv-parse-variables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fdotenv-parse-variables/lists"}