mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
include() should not be used by libraries because it will pollute the global
namespace. To discourage this behavior and bring Node more in-line with
the current CommonJS module system, include() is removed.
Small scripts like unit tests often times do want to pollute the global
namespace for ease. To avoid the boiler plate code of
var x = require("/x.js");
var foo = x.foo;
var bar = x.bar;
The function node.mixin() is stolen from jQuery's jQuery.extend. So that it
can be written:
node.mixin(require("/x.js"));
Reference:
http://docs.jquery.com/Utilities/jQuery.extend
http://groups.google.com/group/nodejs/browse_thread/thread/f9ac83e5c11e7e87
12 lines
288 B
JavaScript
Executable File
12 lines
288 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
node.mixin(require("/utils.js"));
|
|
puts("Welcome to the Node.js REPL.");
|
|
puts("Enter ECMAScript at the prompt.");
|
|
puts("Tip 1: Use 'rlwrap node-repl' for a better interface");
|
|
puts("Tip 2: Type Control-D to exit.");
|
|
|
|
require("/repl.js").start();
|
|
|
|
// vim:ft=javascript
|