Skip to content

Commit

Permalink
doc: add more details to process.env
Browse files Browse the repository at this point in the history
process.env has a few quirks that deserve documenting.

The commit documents:

- How assigning to process.env will implicitly call `toString()`
- How to remove an environment variable from process.env

PR-URL: #4924
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
  • Loading branch information
evanlucas committed Jan 30, 2016
1 parent 6894c62 commit 8ff9b56
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions doc/api/process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,31 @@ process.env.foo = 'bar';
console.log(process.env.foo);
```

Assigning a property on `process.env` will implicitly convert the value
to a string.

Example:

```js
process.env.test = null;
console.log(process.env.test);
// => 'null'
process.env.test = undefined;
console.log(process.env.test);
// => 'undefined'
```

Use `delete` to delete a property from `process.env`.

Example:

```js
process.env.TEST = 1;
delete process.env.TEST;
console.log(process.env.TEST);
// => undefined
```

## process.execArgv

This is the set of Node.js-specific command line options from the
Expand Down

0 comments on commit 8ff9b56

Please sign in to comment.