Use this operator to transform a current window location information into some another. Operator gets a single argument - a (regexp) route to a stream of values.
import { route, ofHistory } from '@hullo/browser'import { createBrowserHistory } from 'history';​const history = createBrowserHistory({});​const history$ = ofHistory(history);​history$.pipe(route([{when: /^\/test\/([0-9]+)$/,have: (...args) => ["test", ...args].join("-")},{ when: /^\/[a-z]$/, have: () => "letters" },{ when: /^\/[0-9]$/, have: () => "numbers" },{ when: /^\/$/, have: () => "index" }])).subscribe({next: v => {console.log('@', v);}});​await history$.next({ pathname: "/d" });// changes the location// but because of derivative stream// also prints "@ letters"​await history$.next({ pathname: "/0" });// changes the location// but because of derivative stream// also prints "@ numbers"​await history$.next({ pathname: "/test/42" });// changes the location// but because of derivative stream// also prints "@ test-42"