Liking cljdoc? Tell your friends :D

bangmod.router.table

The pure half of route compilation: the bidi-table walk, minus the defmethod/registry side effects, so it can be unit-tested under :node-test (bangmod.router.internal cannot load there — pushy and reagent touch js/window at load time).

Grammar accepted — bidi's, with one change: a leaf is [handler-keyword component] instead of a bare handler.

RoutePair := [Pattern Matched] Matched := [handler-kw component] | {Pattern Matched ...} | [RoutePair ...]

Patterns (strings, ["/projects/" :id] vectors, ...) are never walked, so a path parameter keyword is never mistaken for a handler.

The pure half of route compilation: the bidi-table walk, minus the defmethod/registry
side effects, so it can be unit-tested under `:node-test` (`bangmod.router.internal`
cannot load there — pushy and reagent touch `js/window` at load time).

Grammar accepted — bidi's, with one change: a leaf is `[handler-keyword component]`
instead of a bare handler.

  RoutePair := [Pattern Matched]
  Matched   := [handler-kw component] | {Pattern Matched ...} | [RoutePair ...]

Patterns (strings, `["/projects/" :id]` vectors, ...) are never walked, so a path
parameter keyword is never mistaken for a handler.
raw docstring

compile-matchedclj/s

(compile-matched matched register-leaf!)

Compiles the matched side of a route pair: calls (register-leaf! handler-kw component) for every leaf and returns the structure with each leaf replaced by its handler keyword — i.e. a plain bidi table. Throws on anything outside the grammar, with the offending form in the message — a malformed table must not compile into one that silently matches nothing.

Compiles the `matched` side of a route pair: calls `(register-leaf! handler-kw component)`
for every leaf and returns the structure with each leaf replaced by its handler keyword —
i.e. a plain bidi table. Throws on anything outside the grammar, with the offending form
in the message — a malformed table must not compile into one that silently matches
nothing.
sourceraw docstring

compile-pairclj/s

(compile-pair pair register-leaf!)

Compiles one [pattern matched] route pair.

Compiles one `[pattern matched]` route pair.
sourceraw docstring

matched-keysclj/s

(matched-keys matched)

Handler keywords reachable in a compiled matched value. Only map VALUES and pair SECONDS are followed — a pattern is never walked, so ["/projects/" :id] cannot produce a phantom :id route.

Handler keywords reachable in a compiled `matched` value. Only map VALUES and pair
SECONDS are followed — a pattern is never walked, so `["/projects/" :id]` cannot
produce a phantom `:id` route.
sourceraw docstring

route-keysclj/s

(route-keys compiled-pair)

Handler keywords reachable in one compiled route pair.

Handler keywords reachable in one compiled route pair.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close