Call a “local” function within module.exports from another function in module.exports?

Source: https://stackoverflow.com/questions/10462223/call-a-local-function-within-module-exports-from-another-function-in-module-ex
https://stackoverflow.com/questions/33078967/node-js-call-a-local-function-within-module-exports/33080602

I think I got it. I just changed this.foo() to module.exports.foo() and it seems to be working.
If someone has a better or more proper method, please feel free to correct me.

"use strict"
var self = module.exports = {
    myName : function(req, res, next) {
        // accessing method within controller
        self.getName(data);
    },

    getName : function(data) {
        // code
    }
}

Không có nhận xét nào:

Is it okay to use both fetchpriority="high" and loading="eager" in img tag?

 https://stackoverflow.com/questions/77744344/is-it-okay-to-use-both-fetchpriority-high-and-loading-eager-in-img-tag Yes Fetchpriority and l...