Comparing version 0.14.1 to 0.14.2
@@ -168,6 +168,6 @@ import { konsole } from './Konsole'; | ||
predicate: Predicate<M>, | ||
ifRouterOrHandler: RouterOrHandler<M>, | ||
thenRouterOrHandler: RouterOrHandler<M>, | ||
elseRouterOrHandler?: RouterOrHandler<M>, | ||
) { | ||
const ifRouter = Router.from(ifRouterOrHandler); | ||
const thenRouter = Router.from(thenRouterOrHandler); | ||
const elseRouter = Router.from(elseRouterOrHandler); | ||
@@ -177,3 +177,3 @@ | ||
.flatMap(n => n | ||
? ifRouter.getRoute(m) | ||
? thenRouter.getRoute(m) | ||
: elseRouter.getRoute(m) | ||
@@ -187,6 +187,6 @@ ) | ||
predicate: Predicate<M>, | ||
ifRouterOrHandler: RouterOrHandler<M>, | ||
thenRouterOrHandler: RouterOrHandler<M>, | ||
elseRouterOrHandler?: RouterOrHandler<M> | ||
): ifTrueRouter<M> { | ||
return new ifTrueRouter(predicate, ifRouterOrHandler, elseRouterOrHandler); | ||
return new ifTrueRouter(predicate, thenRouterOrHandler, elseRouterOrHandler); | ||
} | ||
@@ -201,6 +201,6 @@ | ||
matcher: Matcher<M, N>, | ||
ifRouterOrHandler: RouterOrHandler<N>, | ||
thenRouterOrHandler: RouterOrHandler<N>, | ||
elseRouterOrHandler?: RouterOrHandler<M> | ||
) { | ||
const ifRouter = Router.from(ifRouterOrHandler); | ||
const thenRouter = Router.from(thenRouterOrHandler); | ||
const elseRouter = Router.from(elseRouterOrHandler); | ||
@@ -210,3 +210,3 @@ | ||
.flatMap(n => n | ||
? ifRouter.getRoute(n) | ||
? thenRouter.getRoute(n) | ||
.map(route => routeWithCombinedScore(route, n.score)) | ||
@@ -221,6 +221,6 @@ : elseRouter.getRoute(m) | ||
matcher: Matcher<M, N>, | ||
ifRouterOrHandler: RouterOrHandler<N>, | ||
thenRouterOrHandler: RouterOrHandler<N>, | ||
elseRouterOrHandler?: RouterOrHandler<M> | ||
): ifMatchesRouter<M, N> { | ||
return new ifMatchesRouter(matcher, ifRouterOrHandler, elseRouterOrHandler); | ||
return new ifMatchesRouter(matcher, thenRouterOrHandler, elseRouterOrHandler); | ||
} | ||
@@ -227,0 +227,0 @@ |
@@ -44,5 +44,5 @@ import { Observable } from 'rxjs'; | ||
export declare class ifTrueRouter<M extends Routable> extends Router<M> { | ||
constructor(predicate: Predicate<M>, ifRouterOrHandler: RouterOrHandler<M>, elseRouterOrHandler?: RouterOrHandler<M>); | ||
constructor(predicate: Predicate<M>, thenRouterOrHandler: RouterOrHandler<M>, elseRouterOrHandler?: RouterOrHandler<M>); | ||
} | ||
export declare function ifTrue<M extends Routable>(predicate: Predicate<M>, ifRouterOrHandler: RouterOrHandler<M>, elseRouterOrHandler?: RouterOrHandler<M>): ifTrueRouter<M>; | ||
export declare function ifTrue<M extends Routable>(predicate: Predicate<M>, thenRouterOrHandler: RouterOrHandler<M>, elseRouterOrHandler?: RouterOrHandler<M>): ifTrueRouter<M>; | ||
export interface Matcher<M extends Routable = {}, Z extends Routable = {}> { | ||
@@ -52,5 +52,5 @@ (m: M): Observableable<Z>; | ||
export declare class ifMatchesRouter<M extends Routable, N extends Routable> extends Router<M> { | ||
constructor(matcher: Matcher<M, N>, ifRouterOrHandler: RouterOrHandler<N>, elseRouterOrHandler?: RouterOrHandler<M>); | ||
constructor(matcher: Matcher<M, N>, thenRouterOrHandler: RouterOrHandler<N>, elseRouterOrHandler?: RouterOrHandler<M>); | ||
} | ||
export declare function ifMatches<M extends Routable, N extends Routable>(matcher: Matcher<M, N>, ifRouterOrHandler: RouterOrHandler<N>, elseRouterOrHandler?: RouterOrHandler<M>): ifMatchesRouter<M, N>; | ||
export declare function ifMatches<M extends Routable, N extends Routable>(matcher: Matcher<M, N>, thenRouterOrHandler: RouterOrHandler<N>, elseRouterOrHandler?: RouterOrHandler<M>): ifMatchesRouter<M, N>; | ||
export declare function throwRoute<M extends Routable>(): Router<M>; | ||
@@ -57,0 +57,0 @@ export declare function catchRoute<M extends Routable>(routerOrHandler: RouterOrHandler<M>): Router<M>; |
@@ -175,9 +175,9 @@ "use strict"; | ||
__extends(ifTrueRouter, _super); | ||
function ifTrueRouter(predicate, ifRouterOrHandler, elseRouterOrHandler) { | ||
function ifTrueRouter(predicate, thenRouterOrHandler, elseRouterOrHandler) { | ||
var _this = this; | ||
var ifRouter = Router.from(ifRouterOrHandler); | ||
var thenRouter = Router.from(thenRouterOrHandler); | ||
var elseRouter = Router.from(elseRouterOrHandler); | ||
_this = _super.call(this, function (m) { return toObservable(predicate(m)) | ||
.flatMap(function (n) { return n | ||
? ifRouter.getRoute(m) | ||
? thenRouter.getRoute(m) | ||
: elseRouter.getRoute(m); }); }) || this; | ||
@@ -189,4 +189,4 @@ return _this; | ||
exports.ifTrueRouter = ifTrueRouter; | ||
function ifTrue(predicate, ifRouterOrHandler, elseRouterOrHandler) { | ||
return new ifTrueRouter(predicate, ifRouterOrHandler, elseRouterOrHandler); | ||
function ifTrue(predicate, thenRouterOrHandler, elseRouterOrHandler) { | ||
return new ifTrueRouter(predicate, thenRouterOrHandler, elseRouterOrHandler); | ||
} | ||
@@ -196,9 +196,9 @@ exports.ifTrue = ifTrue; | ||
__extends(ifMatchesRouter, _super); | ||
function ifMatchesRouter(matcher, ifRouterOrHandler, elseRouterOrHandler) { | ||
function ifMatchesRouter(matcher, thenRouterOrHandler, elseRouterOrHandler) { | ||
var _this = this; | ||
var ifRouter = Router.from(ifRouterOrHandler); | ||
var thenRouter = Router.from(thenRouterOrHandler); | ||
var elseRouter = Router.from(elseRouterOrHandler); | ||
_this = _super.call(this, function (m) { return toObservable(matcher(m)) | ||
.flatMap(function (n) { return n | ||
? ifRouter.getRoute(n) | ||
? thenRouter.getRoute(n) | ||
.map(function (route) { return routeWithCombinedScore(route, n.score); }) | ||
@@ -211,4 +211,4 @@ : elseRouter.getRoute(m); }); }) || this; | ||
exports.ifMatchesRouter = ifMatchesRouter; | ||
function ifMatches(matcher, ifRouterOrHandler, elseRouterOrHandler) { | ||
return new ifMatchesRouter(matcher, ifRouterOrHandler, elseRouterOrHandler); | ||
function ifMatches(matcher, thenRouterOrHandler, elseRouterOrHandler) { | ||
return new ifMatchesRouter(matcher, thenRouterOrHandler, elseRouterOrHandler); | ||
} | ||
@@ -215,0 +215,0 @@ exports.ifMatches = ifMatches; |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "0.14.1", | ||
"version": "0.14.2", | ||
"description": "rules-based app engine", | ||
@@ -10,0 +10,0 @@ "main": "dist/prague.js", |
Sorry, the diff of this file is not supported yet
181988