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:

StaticImage

  import React , { useEffect , useRef } from "react" import { StaticImage } from "gatsby-plugin-image" impor...