Modmod
"Simplicity is the ultimate sophistication." ― Leonardo da Vinci
Just dig into some node-modules you use or the one you released, how many require statements do you have?
Stephen Sawchuk has made require-ing modules less require-y, with his modmod module!
Installing it is like another other module: npm install modmod
How does it help?
It helps you to reduce:
1 2 3 4 5 |
|
To:
1
|
|
It's just eight lines of code that does the magic:
1 2 3 4 5 6 7 8 |
|
require('repl')._builtinLibs
will give a list of all node buitins, if not in the list, it will look for the node_modules
dir in the current working dir and then require
the required there by making it less require-y!
Why?
As said by the author:
It's up to you. There's nothing wrong with the current system of multiple var declarations, and having too many isn't a node problem. Regardless, you may still consider it useful to namespace your dependencies under a name of your choosing, such as M or $, freeing up those "global" variables for use without conflicts.
GIF FTW!
Enjoy your less require-y week ;)
P.S: This module is just six days old! Will need to evolve on things like this. do contribute your ideas to make it more awesome!