From 396e4b9199ce0ed7dad034514d286a824be9526d Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Wed, 27 Jan 2016 21:27:56 -0600 Subject: [PATCH] doc: add more details to process.env 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: https://github.com/nodejs/node/pull/4924 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Roman Reiss --- doc/api/process.markdown | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/api/process.markdown b/doc/api/process.markdown index e0d6451e67824a..4f739c0dc70567 100644 --- a/doc/api/process.markdown +++ b/doc/api/process.markdown @@ -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