victorb / trymodule

➰ It's never been easier to try nodejs modules!
1.14k stars 29 forks source link

Defining an empty variable name makes a module inaccessible #21

Open shockey opened 8 years ago

shockey commented 8 years ago

Example:

→ trymodule js-yaml=
Gonna start a REPL with packages installed and loaded for you
Couldn't find 'js-yaml' locally, gonna download it now
js-yaml@3.6.1 .trymodule/node_modules/js-yaml
├── esprima@2.7.2
└── argparse@1.0.7 (sprintf-js@1.0.3)
Package 'js-yaml' was loaded and assigned to '' in the current scope
REPL started...
>

This was a typo on my part, and strictly speaking, it isn't a bug... but it definitely would have been a nice user experience for trymodule to have picked up on my mistake and defaulted to the module's name.

Thoughts?

victorb commented 7 years ago

Agreed, should default to the modules name as if you omitted the equal sign completely.