New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

prague

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prague - npm Package Compare versions

Comparing version 0.16.2 to 0.16.3

14

core/Router.ts

@@ -320,13 +320,11 @@ import { konsole } from './Konsole';

getKey: (routable: ROUTABLE) => Observableable<string>,
mapKeyToGetRouter: Record<string, (routable: ROUTABLE) => Observableable<Router<ROUTABLE>>>
getMapKeyToRouter: (routable: ROUTABLE) => Observableable<Record<string, Router<ROUTABLE>>>
): GetRoute$<ROUTABLE> {
return routable => toObservable(getKey(routable))
.map(key => mapKeyToGetRouter[key])
.flatMap(getRouter => getRouter
? toObservable(getRouter(routable))
.map(Router.toRouter)
.flatMap(router => router._getRoute$(routable))
: Observable.of(Router.noRoute())
);
.flatMap(key => toObservable(getMapKeyToRouter(routable))
.map(mapKeyToRouter => mapKeyToRouter[key])
)
.map(Router.toRouter)
.flatMap(router => router._getRoute$(routable));
}
}

@@ -51,3 +51,3 @@ import { Observable } from 'rxjs';

static getRouteDefault$<ROUTABLE>(mainRouter: Router<ROUTABLE>, getDefaultRouter: (routable: ROUTABLE, reason: string) => Observableable<Router<ROUTABLE>>): GetRoute$<ROUTABLE>;
static getRouteSwitch$<ROUTABLE>(getKey: (routable: ROUTABLE) => Observableable<string>, mapKeyToGetRouter: Record<string, (routable: ROUTABLE) => Observableable<Router<ROUTABLE>>>): GetRoute$<ROUTABLE>;
static getRouteSwitch$<ROUTABLE>(getKey: (routable: ROUTABLE) => Observableable<string>, getMapKeyToRouter: (routable: ROUTABLE) => Observableable<Record<string, Router<ROUTABLE>>>): GetRoute$<ROUTABLE>;
}

@@ -214,10 +214,8 @@ "use strict";

};
Router.getRouteSwitch$ = function (getKey, mapKeyToGetRouter) {
Router.getRouteSwitch$ = function (getKey, getMapKeyToRouter) {
return function (routable) { return toObservable(getKey(routable))
.map(function (key) { return mapKeyToGetRouter[key]; })
.flatMap(function (getRouter) { return getRouter
? toObservable(getRouter(routable))
.map(Router.toRouter)
.flatMap(function (router) { return router._getRoute$(routable); })
: rxjs_1.Observable.of(Router.noRoute()); }); };
.flatMap(function (key) { return toObservable(getMapKeyToRouter(routable))
.map(function (mapKeyToRouter) { return mapKeyToRouter[key]; }); })
.map(Router.toRouter)
.flatMap(function (router) { return router._getRoute$(routable); }); };
};

@@ -224,0 +222,0 @@ Router.minRoute = Router.actionRoute(function () {

@@ -7,3 +7,3 @@ {

},
"version": "0.16.2",
"version": "0.16.3",
"description": "rules-based app engine",

@@ -10,0 +10,0 @@ "main": "dist/prague.js",

@@ -1087,5 +1087,5 @@ "use strict";

it("doesn't route on undefined key", done => {
Router.route$(foo, new Router(Router.getRouteSwitch$(c => undefined, {
foo: () => routerDo(throwErr)
})))
Router.route$(foo, new Router(Router.getRouteSwitch$(c => undefined, () => ({
foo: routerDo(throwErr)
}))))
.subscribe(t => {

@@ -1097,5 +1097,5 @@ expect(t).to.be.false;

it("doesn't route on null key", done => {
Router.route$(foo, new Router(Router.getRouteSwitch$(c => undefined, {
foo: () => routerDo(throwErr)
})))
Router.route$(foo, new Router(Router.getRouteSwitch$(c => undefined, () => ({
foo: routerDo(throwErr)
}))))
.subscribe(t => {

@@ -1107,5 +1107,5 @@ expect(t).to.be.false;

it("doesn't route on non-matching key", done => {
Router.route$(foo, new Router(Router.getRouteSwitch$(c => 'bar', {
foo: () => routerDo(throwErr)
})))
Router.route$(foo, new Router(Router.getRouteSwitch$(c => 'bar', () => ({
foo: routerDo(throwErr)
}))))
.subscribe(t => {

@@ -1118,7 +1118,7 @@ expect(t).to.be.false;

let routed = false;
Router.route$(foo, new Router(Router.getRouteSwitch$(c => 'foo', {
foo: () => routerDo(c => {
Router.route$(foo, new Router(Router.getRouteSwitch$(c => 'foo', () => ({
foo: routerDo(c => {
routed = true;
}),
})))
}))))
.subscribe(t => {

@@ -1132,8 +1132,8 @@ expect(t).to.be.true;

let routed = false;
Router.route$(foo, new Router(Router.getRouteSwitch$(c => 'foo', {
foo: () => routerDo(c => {
Router.route$(foo, new Router(Router.getRouteSwitch$(c => 'foo', () => ({
foo: routerDo(c => {
routed = true;
}),
bar: routerDo(throwErr)
})))
}))))
.subscribe(t => {

@@ -1147,8 +1147,8 @@ expect(t).to.be.true;

let routed = false;
Router.route$(foo, new Router(Router.getRouteSwitch$(c => 'foo', {
bar: () => routerDo(throwErr),
foo: () => routerDo(c => {
Router.route$(foo, new Router(Router.getRouteSwitch$(c => 'foo', () => ({
bar: routerDo(throwErr),
foo: routerDo(c => {
routed = true;
})
})))
}))))
.subscribe(t => {

@@ -1161,5 +1161,5 @@ expect(t).to.be.true;

it("doesn't route when router for key doesn't route", done => {
Router.route$(foo, new Router(Router.getRouteSwitch$(c => 'foo', {
foo: () => routerNo()
})))
Router.route$(foo, new Router(Router.getRouteSwitch$(c => 'foo', () => ({
foo: routerNo()
}))))
.subscribe(t => {

@@ -1169,2 +1169,15 @@ expect(t).to.be.false;

});
it("conditionally routes", done => {
let routed;
Router.route$(foo, new Router(Router.getRouteSwitch$(c => 'foo', (c) => ({
foo: c.foo === 'foo'
? routerDo(c => { routed = true; })
: routerDo(throwErr)
}))))
.subscribe(t => {
expect(t).to.be.true;
expect(routed).to.be.true;
}, passErr, done);
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc