{"id":23714608,"url":"https://github.com/osamaadam/explode-env","last_synced_at":"2026-02-06T00:31:43.613Z","repository":{"id":248922850,"uuid":"829661489","full_name":"osamaadam/explode-env","owner":"osamaadam","description":"Replace environment variables within text.","archived":false,"fork":false,"pushed_at":"2024-07-19T18:36:44.000Z","size":533,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-04T16:42:16.691Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/explode-env","language":"TypeScript","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/osamaadam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-16T22:00:16.000Z","updated_at":"2024-07-19T18:36:48.000Z","dependencies_parsed_at":"2024-07-17T23:45:53.674Z","dependency_job_id":"ebadbeb8-6794-4f37-9ed4-0040c3ad7908","html_url":"https://github.com/osamaadam/explode-env","commit_stats":null,"previous_names":["osamaadam/expand-env"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/osamaadam/explode-env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osamaadam%2Fexplode-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osamaadam%2Fexplode-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osamaadam%2Fexplode-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osamaadam%2Fexplode-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osamaadam","download_url":"https://codeload.github.com/osamaadam/explode-env/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osamaadam%2Fexplode-env/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29140125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T23:14:48.546Z","status":"ssl_error","status_checked_at":"2026-02-05T23:14:35.724Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2024-12-30T20:32:01.811Z","updated_at":"2026-02-06T00:31:43.596Z","avatar_url":"https://github.com/osamaadam.png","language":"TypeScript","readme":"# explode-env\n\nThis is a simple utility to expand environment variables in a string, heavily inspired by Golang's [os.Expand](https://pkg.go.dev/os#Expand).\n\nRegex free, and no dependencies. If you need to expand environment variables in a string, this is the tool for you.\n\n## Installation\n\n```sh\nnpm install explode-env\n```\n\n## Usage\n\n### explode\n\n```ts\nimport { explode } from \"explode-env\";\n\n// Works with ${USER} and $USER\nconst expanded = explode(\"Hello, $USER!\", { USER: \"world\" });\nconsole.log(expanded); // Hello, world!\n```\n\n### explodeEnv\n\nAlias for `explode` with `process.env` as the second argument.\n\n```ts\nimport { explodeEnv } from \"explode-env\";\n\nconst expanded = explodeEnv(\"Hello, $USER!\");\nconsole.log(expanded); // Hello, \u003cyour username\u003e!\n```\n\n### Options\n\nYou can pass an options object as the third argument to `explode` and second argument to `explodeEnv`.\n\n#### ignoreUnsetVars\n\nIf `true`, variables that are not set in the mapping will not be expanded.\n\n```ts\nimport { explode } from \"explode-env\";\n\nconst expanded = explode(\n  \"Hello, $USER!, and $OTHERS!\",\n  { OTHERS: \"User X, User Y\" },\n  {\n    ignoreUnsetVars: true,\n  }\n);\n\nconsole.log(expanded); // Hello, $USER!, and User X, User Y!\n```\n\n#### ignoreDefaultExpansion\n\nIf `true`, default expansion in the form of `${var:-default}` or `${var:=default}` will not be expanded.\n\n\u003e Note: This will NOT work with $var:-default or $var:=default.\n\u003e For reference: \u003chttps://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02\u003e\n\n```ts\nimport { explode } from \"explode-env\";\n\nconst expanded = explode(\n  \"Hello, ${WORLD:=World}! Welcome ${WORLD}!\"\n  {},\n  {\n    ignoreDefaultExpansion: false,\n  }\n);\n\nconsole.log(expanded); // Hello, World! Welcome World!\n```\n\n```ts\nimport { explode } from \"explode-env\";\n\nconst expanded = explode(\n  \"Hello, ${WORLD:=World}! Welcome ${WORLD}!\"\n  {},\n  {\n    ignoreDefaultExpansion: true,\n  }\n);\n\nconsole.log(expanded); // Hello, ! Welcome !\n```\n\n## Running tests\n\n```sh\nnpm test\n```\n\n## Publishing a new version\n\n```sh\nnpm version \u003cmajor|minor|patch\u003e\ngit push --tags\n```\n\nThen, GitHub Actions will take care of the rest.\n\n## License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosamaadam%2Fexplode-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosamaadam%2Fexplode-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosamaadam%2Fexplode-env/lists"}