Express middleware to provide consistently parseable query parameters to universal applications
Default callback behavior for the middleware
Can be replaced by passing a function argument in the
first position to queryValidator
. It will receive the
same arguments.
Parameters
Returns undefined
Create a middleware to validate queries are parseable by both the browser and node. This should be mounted early.
Parameters
cb
[Function?](default defaultRedirect) called to handle invalid params. passedreq
,res
,next
and acontext
object containing useful data. The default behavior is toconsole.error
andres.redirect
options
[Object?](default {})options.delimiter
string? query string delimiter
Returns Function middleware - the middleware function to use
Parameters
Returns undefined
Utility functions needed for this module
Checks if a key=value param can not be
parsed by global decodeURIComponent
Parameters
query
[string](default 'key=value')
Returns boolean did parsing throw?
Are all queries parseable?
Parameters
queries
[Array](default [])
Returns boolean
Returns input minus unparseable queries
Parameters
queries
[Array](default [])
Returns Array