question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

support variadic usage (rather than requiring an array)

See original GitHub issue

this is just my ocd, but imo the latter looks much nicer:

app.use(route.get('/foo', compose([ middleware1, middleware2, routeHandler ])))

vs

app.use(route.get('/foo', compose(middleware1, middleware2, routeHandler)))

would you take a pr implementing this in a backward compatible way?

/cc @jonathanong

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
jonathanongcommented, Oct 21, 2016

i would personally like:

function compose(...args) {
  const middleware = _.flatten(args)
  // ...
}

@tj @juliangruber @dead-horse @fengmk2 thoughts?

0reactions
stephenmathiesoncommented, Sep 6, 2020

I forgot the PR that added this got reverted and wasted a bunch of time debugging… any chance we’d be up for trying this again?

Also, any news on the use-case for mutating middleware?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Variadic Parameters that Accept Array Inputs - Swift Forums
Variadic parameters should accept Array (and maybe Set ) as a valid inputs, so to make variadic parameters easier to use and more...
Read more >
How to use an array as argument to a VARIADIC function in ...
You can do that by specifying VARIADIC in the call: SELECT mleast(VARIADIC ARRAY[10, -1, 5, 4.4]); More details: Select rows such that names ......
Read more >
Why can arrays not be used _directly_ when calling a variadic ...
Basically, in Go arrays are secondary. Slices are the way to go. You should have a slice in the first place, which you...
Read more >
Modern C++ and Variadic Functions: How to Shoot Yourself in ...
It is possible to declare function with a variable number of arguments, i.e. the number of function arguments can be greater than the...
Read more >
Ultimate Guide to Go Variadic Functions | by Inanc Gumus
Learn everything about Golang variadic funcs visually with common usage patterns.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found