joyent/node — pull request #3178 by regality (2012-04-26 05:59:35+00:00)
Title: Added magic sauce for .noderc.js in $HOME and `pwd`

This patch allows a user to create a file called `.noderc.js` and place it in their home directory, or the directory they start node from.

When node is started with the `-i` flag or without arguments, it fires up the REPL.
At this point it will check if `~/.noderc.js` or `/.noderc.js` exist. If they do, whatever objects they export will be copied into the repl context and be available for use.

The most common use case for this will likely be loading debugging tools. For example I have the following as my noderc:

```javascript
var util = require('util');

function inspect(obj) {
console.log(util.inspect(obj, true, 10, true));
}

exports.p = inspect;
```

That way whenever I start the node repl, I can just type `p({some:'huge object'})` without having to retype basic boilerplate *every* time I start node.