summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2009-10-05 15:46:31 +0200
committerRyan Dahl <ry@tinyclouds.org>2009-10-05 15:46:31 +0200
commit8185e1fd2501d2d5001d254213c41002440ec7fc (patch)
tree0f899b26354464329572be87f33d0677a45007b7 /bin
parent522909bcbf6ff577ddf66b8c07148cf581615157 (diff)
downloadnode-8185e1fd2501d2d5001d254213c41002440ec7fc.tar.gz
Remove include() add node.mixin()
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
Diffstat (limited to 'bin')
-rwxr-xr-xbin/node-repl2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/node-repl b/bin/node-repl
index 20f04e89f..00975dc37 100755
--- a/bin/node-repl
+++ b/bin/node-repl
@@ -1,6 +1,6 @@
#!/usr/bin/env node
-include("/utils.js");
+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");