zoukankan      html  css  js  c++  java
  • exports 和 module.exports 的区别

    http://stackoverflow.com/questions/7137397/module-exports-vs-exports-in-node-js

    其中推荐回答:

    http://www.hacksparrow.com/node-js-exports-vs-module-exports.html

     module.exports is the real dealexports is just module.exports's little helper. Your module returns module.exports to the caller ultimately, not exports. All exports does is collect properties and attach them to module.exports IF module.exportsdoesn't have something on it already. If there's something attached to module.exports already, everything on exports is ignored.

    exports只是作为helper,exports做的仅仅是收集module.exports所没有的属性并把它们挂在到module.exports上,如果module.exports已有某属性,exports的该属性会被直接忽略。

    As long are you don't overwrite the module.exports object with an assignment operation, anything attached to module.exports and exports will be available in the 'required' module.

    只要你不用赋值符号(=)重写module.exports 对象,任何挂在到module.exports and export的属性在required的模块里都是可用的。

  • 相关阅读:
    Django-用户认证组件
    Django-session组件
    Axer-使用Msfvenom自动创建有效负载的工具
    CVE-2020-0668-Windows服务跟踪中的普通特权升级错误
    隐藏Web Shell
    404 not found Webshell
    渗透测试流程
    IIS inprocess
    分布式.Net
    WPF UnhandledException
  • 原文地址:https://www.cnblogs.com/alexandra/p/6149226.html
Copyright © 2011-2022 走看看