I notice that Node defines both process.argv
and process.ARGV
(capitalized). The later isn't mentioned in the documentation and is, in every case I've encountered so far, the same object.
Is ARGV
just a historic holdover, or does it have a purpose?
I notice that Node defines both process.argv
and process.ARGV
(capitalized). The later isn't mentioned in the documentation and is, in every case I've encountered so far, the same object.
Is ARGV
just a historic holdover, or does it have a purpose?
2 Answers
Reset to default 10process.ARGV
has been removed entirely since v0.5.10
.
They are identical:
node
// process.argv
Local<Array> arguments = Array::New(argc - option_end_index + 1);
arguments->Set(Integer::New(0), String::New(argv[0]));
for (j = 1, i = option_end_index; i < argc; j++, i++) {
Local<String> arg = String::New(argv[i]);
arguments->Set(Integer::New(j), arg);
}
// assign it
process->Set(String::NewSymbol("ARGV"), arguments);
process->Set(String::NewSymbol("argv"), arguments);
Edit (based on further question):
There's only one person who can tell you that for sure (the author) - you might be able to find him on IRC (irc.freenode #node.js
).
Looking through the other symbols, I'd guess that it was added for consistency - argv
and env
seem to be the only two that have both lower and upper case versions. However, ENV
differs slightly from env
. Maybe the author thought that argv
and ARGV
might differ in the same manner as env
and ENV
?