Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevenvachon/edit-dotenv
Edit a .env file string with preserved comments and whitespace.
https://github.com/stevenvachon/edit-dotenv
comments dotenv nodejs whitespace
Last synced: 2 months ago
JSON representation
Edit a .env file string with preserved comments and whitespace.
- Host: GitHub
- URL: https://github.com/stevenvachon/edit-dotenv
- Owner: stevenvachon
- License: mit
- Created: 2017-07-10T00:03:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-01T01:19:34.000Z (over 4 years ago)
- Last Synced: 2024-10-06T04:23:31.128Z (3 months ago)
- Topics: comments, dotenv, nodejs, whitespace
- Language: JavaScript
- Homepage:
- Size: 35.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# edit-dotenv [![NPM Version][npm-image]][npm-url] [![Linux Build][travis-image]][travis-url] [![Windows Build][appveyor-image]][appveyor-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependency Monitor][greenkeeper-image]][greenkeeper-url]
> Edit a `.env` file string with preserved comments and whitespace.
## Installation
[Node.js](http://nodejs.org/) `>= 6` is required. To install, type this at the command line:
```shell
npm install edit-dotenv
```## Usage
```js
const editDotenv = require('edit-dotenv');const envString = `VAR1=value
VAR2=value# Comment
VAR3=value\\nvalue`;const changes = {
VAR2: 'new value',
NEW: 'value'
};editDotenv(envString, changes);
/*↴
VAR1=value
VAR2=new value# Comment
VAR3=value\\nvalueNEW=value
*/
```[npm-image]: https://img.shields.io/npm/v/edit-dotenv.svg
[npm-url]: https://npmjs.com/package/edit-dotenv
[travis-image]: https://img.shields.io/travis/stevenvachon/edit-dotenv.svg?label=linux
[travis-url]: https://travis-ci.org/stevenvachon/edit-dotenv
[appveyor-image]: https://img.shields.io/appveyor/ci/stevenvachon/edit-dotenv.svg?label=windows
[appveyor-url]: https://ci.appveyor.com/project/stevenvachon/edit-dotenv
[coveralls-image]: https://img.shields.io/coveralls/stevenvachon/edit-dotenv.svg
[coveralls-url]: https://coveralls.io/github/stevenvachon/edit-dotenv
[greenkeeper-image]: https://badges.greenkeeper.io/stevenvachon/edit-dotenv.svg
[greenkeeper-url]: https://greenkeeper.io/