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 authored and Myles Borins committed Feb 17, 2016
1 parent 6afd2a4 commit 2bc27b3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions doc/api/process.markdown
Expand Up @@ -389,6 +389,31 @@ But this will:
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 2bc27b3

Please sign in to comment.