Closed glasser closed 9 years ago
Ah, yes, it is installed globally by default in Node (like all/most built-in modules, I believe?), but I don't like to rely on that, either.
Are you sure? I think what you're thinking of is something that's specific to the repl.
glasser@glasser-lyrid 8 /tmp $ cat foo.js
assert();
glasser@glasser-lyrid 0 /tmp $ node foo.js
/private/tmp/foo.js:1
(function (exports, require, module, __filename, __dirname) { assert();
^
ReferenceError: assert is not defined
at Object.<anonymous> (/private/tmp/foo.js:1:63)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:935:3
glasser@glasser-lyrid 8 /tmp $ node
> assert()
AssertionError: "undefined" == true
at repl:1:2
at REPLServer.self.eval (repl.js:110:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
at Interface._onLine (readline.js:203:10)
at Interface.<anonymous> (readline.js:323:12)
at Array.forEach (native)
at Interface._normalWrite (readline.js:322:11)
at ReadStream.ondata (readline.js:92:10)
at ReadStream.emit (events.js:95:17)
>
Or is assert magically in Node's globals?