You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, the library provides the possibility to check :
if the tested element is a function
get a safeFunction
I am implementing it on a custom project, in my case, I'm using it because I have express middleware functions and some need to be generated before, here some example:
const app = express();
// standard express middleware
const myLessStandardExpressMiddleware = (data) => (req, res, next) => {
// do something with my data.
next();
};
app.use(myLessStandardExpressMiddleware(await getAwesomeData());
I want to have the ability to know in which case I'm in because my project allowing custom implementation, I do not know which case I am in.
To solve this issue, I will check the function argument(s) definition: an express middleware is always composed with req, res and next are optionnal.
I am using this stackoverflow post in attempt to do that.
Right now, I will implement it through the custom types (thanks @flexdinesh)
An known issue in this solution is that an user may implement an express middleware with a function with different name parameters. Ex: (request, response, next)
Is this something that could fit in this library ?
The text was updated successfully, but these errors were encountered:
@jadok This sounds interesting but practical use cases might be limited. Perhaps could you provide an example code on how you'd syntactically like to use this feature? We might then be able to dive into the possibilities.
Right now, the library provides the possibility to check :
I am implementing it on a custom project, in my case, I'm using it because I have express middleware functions and some need to be generated before, here some example:
My issue case:
I want to have the ability to know in which case I'm in because my project allowing custom implementation, I do not know which case I am in.
To solve this issue, I will check the function argument(s) definition: an express middleware is always composed with req, res and next are optionnal.
I am using this stackoverflow post in attempt to do that.
Right now, I will implement it through the custom types (thanks @flexdinesh)
An known issue in this solution is that an user may implement an express middleware with a function with different name parameters. Ex:
(request, response, next)
Is this something that could fit in this library ?
The text was updated successfully, but these errors were encountered: