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:

Cold Turkey Blocker

 https://superuser.com/questions/1366153/how-to-get-rid-of-cold-turkey-website-blocker-get-around-the-block Very old question, but still wan...