从github执行示例时,Uglify JS API会抛出TypeError

wma*_*but 3 javascript node.js uglifyjs

我已经安装了uglify-js 2.2.2并尝试使用API​​来缩小node.js应用程序中的一些javascript,但是在尝试访问解析器时出现类型错误.

我的尝试是基于API部分中的github自述文件.

这是我从节点shell获得的尝试/输出.在这里,我甚至没有尝试调用该parse方法,我只是显示它完全无法访问.

$ node
> var jsp = require("uglify-js").parser;
  undefined
> jsp.parse
  TypeError: Cannot read property 'parse' of undefined
    at repl:1:5
    at REPLServer.self.eval (repl.js:111:21)
    at Interface.<anonymous> (repl.js:250:12)
    at Interface.EventEmitter.emit (events.js:88:17)
    at Interface._onLine (readline.js:183:10)
    at Interface._line (readline.js:501:8)
    at Interface._ttyWrite (readline.js:719:14)
    at ReadStream.<anonymous> (readline.js:105:12)
    at ReadStream.EventEmitter.emit (events.js:115:20)
    at emitKey (readline.js:1041:12)
Run Code Online (Sandbox Code Playgroud)

我在这里做错了什么,或者是否有某种我通过谷歌找不到的错误?

wma*_*but 6

原来github自述文件中的"API"信息已过期/不正确.

我挖了这个,这似乎是正确的.https://npmjs.org/package/uglify-js.向下滚动到"API Reference"标题.