How to prototype function in diferent context

216
September 10, 2017, at 07:17 AM

I have function where i pass another 2 functions as parameters, something like:

doSomething(func1,func2)

What i need is to prototype the func1 in other context when the function is being exported.

For example i have 2 diferent files:

in the first one i export a function that receives 2 parameters functions:

module.exports = (func1, func2) => {
}

in the second i pass the parameters as i said before like doSomething(func1,func2)

how can i inside the module.exports prototype the toString in the way i can have a output like this of the function1:

/* func1() */ func2()

i tried this way:

module.exports = (func1, func2) => {
    func1.prototype.toString = function () {
        const comment = `/* ${(_.toString(func1))} */ \n`;
        return comment;
    };
};

the result was the func1 without the /* */ any help with this?

READ ALSO
How to secure angular 4 app code when deployed in Tomcat [on hold]

How to secure angular 4 app code when deployed in Tomcat [on hold]

I have developed an angular 4 app which i need to deploy in productionI have created prod files using npm with AOT compilation

245
Best way to handle authentication on a react-redux single page appliction?

Best way to handle authentication on a react-redux single page appliction?

I'm currently sending the client an empty html document with a few scripts included that set up my single page application with react-reduxAfter everything is set up I'm fetching the dynamic data using AJAX and determine if the user is logged in or not

163
nodejs- req.body not parsing correctly for arrays and embedded object

nodejs- req.body not parsing correctly for arrays and embedded object

I am using nodejs(expressjs) as serverI have android app that sends json request to server

246
What is the javascript `_|_`?

What is the javascript `_|_`?

I was looking through a solution to a problem in javascript, namely parsing a string into its constituent names, operators, and brackets, when I saw this expression:

266