grecha.js
grecha.js copied to clipboard
#2: customizable `route404` variable
i just added an options argument that can define route404 to the router() function.
Passing in two objects inline might be a bit ugly, maybe make a symbol or look for a hard-coded global var-name, which gets called (assuming it's an object, and has routes), if errors or <...>?.<...> == falsey, throw at each.
window[Symbol.for('G_RouterOptions')] = { 'route404': ... }
OR
window.GrechaOptions = { 'route404': ... }
Otherwise, this is fine:
let routes = { ... }
let options = { ... }
let router = router(routes, options)