I have the following test script....
> process.env.SOMETHING === undefined
true
> process.env.SOMETHING = "asdsad";
'asdsad'
> process.env.SOMETHING === undefined
false
> process.env.SOMETHING = undefined
undefined
> process.env.SOMETHING === undefined
false
> process.env.SOMETHING == null
false
> !process.env.SOMETHING
false
> process.env.SOMETHING === "undefined"
true
Why does it get converted to a string?
Because that's what Node requires., at least for now.
Assigning a property on
process.envwill implicitly convert the value to a string. This behavior is deprecated. Future versions of Node.js may throw an error when the value is not a string, number, or boolean.