prague-fluent
Advanced tools
Comparing version 0.16.4 to 0.16.5
@@ -1,2 +0,2 @@ | ||
import { Matcher, Observableable, Predicate, Router } from './FluentRouter'; | ||
import { Matcher, Observableable, Predicate, Handler, Router } from './FluentRouter'; | ||
export * from './FluentRouter'; | ||
@@ -7,3 +7,3 @@ export declare class IfMatchesThen<ROUTABLE, VALUE> extends Router<ROUTABLE> { | ||
constructor(matcher: Matcher<ROUTABLE, VALUE>, getThenRouter: (routable: ROUTABLE, value: VALUE) => Router<ROUTABLE>); | ||
elseDo(elseHandler: (routable: ROUTABLE, reason: string) => Observableable<any>): Router<ROUTABLE>; | ||
elseDo(elseHandler: (routable: ROUTABLE, reason: string) => Observableable<any>, score?: number): Router<ROUTABLE>; | ||
elseTry(elseRouter: Router<ROUTABLE>): Router<ROUTABLE>; | ||
@@ -29,2 +29,3 @@ elseTry(getElseRouter: (routable: ROUTABLE, reason: string) => Router<ROUTABLE>): Router<ROUTABLE>; | ||
tryInScoreOrder(...getRouters: (Router<ROUTABLE> | ((routable: ROUTABLE) => Observableable<Router<ROUTABLE>>))[]): Router<ROUTABLE>; | ||
noop(handler: Handler<ROUTABLE>): Router<ROUTABLE>; | ||
ifMatches<VALUE>(matcher: Matcher<ROUTABLE, VALUE>): IfMatchesFluent<ROUTABLE, VALUE>; | ||
@@ -31,0 +32,0 @@ ifTrue(predicate: Predicate<ROUTABLE>): IfTrueFluent<ROUTABLE>; |
@@ -27,4 +27,4 @@ "use strict"; | ||
} | ||
IfMatchesThen.prototype.elseDo = function (elseHandler) { | ||
return this.elseTry(function (_routable, reason) { return FluentRouter_1.Router.do(function (routable) { return elseHandler(routable, reason); }); }); | ||
IfMatchesThen.prototype.elseDo = function (elseHandler, score) { | ||
return this.elseTry(function (_routable, reason) { return FluentRouter_1.Router.do(function (routable) { return elseHandler(routable, reason); }, score); }); | ||
}; | ||
@@ -104,2 +104,5 @@ IfMatchesThen.prototype.elseTry = function (arg) { | ||
}; | ||
Helpers.prototype.noop = function (handler) { | ||
return new FluentRouter_1.Router(FluentRouter_1.Router.getRouteNoop$(handler)); | ||
}; | ||
Helpers.prototype.ifMatches = function (matcher) { | ||
@@ -106,0 +109,0 @@ return new IfMatchesFluent(matcher); |
{ | ||
"name": "prague-fluent", | ||
"version": "0.16.4", | ||
"version": "0.16.5", | ||
"description": "fluent API for Prague", | ||
@@ -5,0 +5,0 @@ "main": "dist/fluent.js", |
@@ -14,4 +14,7 @@ import { konsole, Matcher, Observableable, toObservable, Predicate, Handler, GetRoute$, Router } from './FluentRouter'; | ||
elseDo(elseHandler: (routable: ROUTABLE, reason: string) => Observableable<any>) { | ||
return this.elseTry((_routable, reason) => Router.do(routable => elseHandler(routable, reason))); | ||
elseDo( | ||
elseHandler: (routable: ROUTABLE, reason: string) => Observableable<any>, | ||
score?: number | ||
) { | ||
return this.elseTry((_routable, reason) => Router.do(routable => elseHandler(routable, reason), score)); | ||
} | ||
@@ -22,3 +25,3 @@ | ||
elseTry(getElseRouter: (routable: ROUTABLE, reason: string) => Router<ROUTABLE>): Router<ROUTABLE>; | ||
elseTry(arg: Router<ROUTABLE> | ((routable: ROUTABLE, reason: string) => Router<ROUTABLE>)) { | ||
@@ -115,3 +118,7 @@ return new Router(Router.getRouteIfMatches$(this.matcher, this.getThenRouter, typeof(arg) === 'function' | ||
))); | ||
} | ||
} | ||
noop (handler: Handler<ROUTABLE>) { | ||
return new Router(Router.getRouteNoop$(handler)); | ||
} | ||
@@ -118,0 +125,0 @@ ifMatches <VALUE>(matcher: Matcher<ROUTABLE, VALUE>) { |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26609
400
0