A failed configuration assignment can look successful: setting process.env.FOO to an object produces the string "[object Object]" when read back. process.env exposes operating-system environment variables, but it is not an ordinary JavaScript object. section 5.2
The runtime treats its properties as accessors whose values are coerced to strings. Thus process.env.FOO = { a: 1 } completes without an error, yet process.env.FOO yields "[object Object]". Property descriptors and internal operations such as [[Get]] and [[Set]] explain why ordinary assignment syntax hides runtime-specific behavior. section 5.2
Unexpected coercion
process.env.FOO = { a: 1 }; // later reads as "[object Object]" rather than an object section 5.2
Table 5.1 The property descriptor attributes and the property types they apply to:
|
Name
|
Description
|
Data Properties
|
Accessor Properties
|
|
[[Value]]
|
A stored JavaScript value
|
✓
|
|
|
[[Writable]]
|
A boolean indicating whether [[Value]] can be changed
|
✓
|
|
|
[[Get]]
|
Code used to compute the property value
|
|
✓
|
|
[[Set]]
|
Code used to modify the property value
|
|
✓
|
|
[[Enumerable]]
|
A boolean indicating whether the property can appear in iterations
|
✓
|
✓
|
|
[[Configurable]]
|
A boolean indicating whether the property descriptor itself can be
changed or deleted
|
✓
|
✓
|
Compare data properties, which store [[Value]], with accessor properties, which use [[Get]] and [[Set]]; process.env relies on the latter behavior. section 5.2
