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.15.2 to 0.15.3

7

core/Router.ts

@@ -279,4 +279,9 @@ import { konsole } from './Konsole';

and (predicate: (value: VALUE) => IfTrue<ROUTABLE>): IfMatches<ROUTABLE, VALUE>;
and (predicate: IfTrue<ROUTABLE>): IfMatches<ROUTABLE, VALUE>;
and <TRANSFORMRESULT> (recognizer: (value: VALUE) => IfMatches<ROUTABLE, TRANSFORMRESULT>): IfMatches<ROUTABLE, TRANSFORMRESULT>;
and <TRANSFORMRESULT> (recognizer: (value: VALUE) => IfMatches<ROUTABLE, TRANSFORMRESULT>) {
and <TRANSFORMRESULT> (recognizer: IfMatches<ROUTABLE, TRANSFORMRESULT>): IfMatches<ROUTABLE, TRANSFORMRESULT>;
and <TRANSFORMRESULT> (arg) {
const recognizer = typeof(arg) === 'function'
? arg as (value: VALUE) => IfMatches<ROUTABLE, any>
: (value: VALUE) => arg as IfMatches<ROUTABLE, any>;
return new IfMatches((routable: ROUTABLE) => toObservable(this.matcher(routable))

@@ -283,0 +288,0 @@ .map(response => IfMatches.normalizeMatcherResponse<VALUE>(response))

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

and(predicate: (value: VALUE) => IfTrue<ROUTABLE>): IfMatches<ROUTABLE, VALUE>;
and(predicate: IfTrue<ROUTABLE>): IfMatches<ROUTABLE, VALUE>;
and<TRANSFORMRESULT>(recognizer: (value: VALUE) => IfMatches<ROUTABLE, TRANSFORMRESULT>): IfMatches<ROUTABLE, TRANSFORMRESULT>;
and<TRANSFORMRESULT>(recognizer: IfMatches<ROUTABLE, TRANSFORMRESULT>): IfMatches<ROUTABLE, TRANSFORMRESULT>;
thenDo(thenHandler: (routable: ROUTABLE, value: VALUE) => Observableable<any>): IfMatchesThen<ROUTABLE, VALUE>;

@@ -80,0 +82,0 @@ thenTry(router: Router<ROUTABLE>): IfMatchesThen<ROUTABLE, VALUE>;

5

dist/core/Router.js

@@ -245,4 +245,7 @@ "use strict";

};
IfMatches.prototype.and = function (recognizer) {
IfMatches.prototype.and = function (arg) {
var _this = this;
var recognizer = typeof (arg) === 'function'
? arg
: function (value) { return arg; };
return new IfMatches(function (routable) { return toObservable(_this.matcher(routable))

@@ -249,0 +252,0 @@ .map(function (response) { return IfMatches.normalizeMatcherResponse(response); })

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

},
"version": "0.15.2",
"version": "0.15.3",
"description": "rules-based app engine",

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

@@ -22,3 +22,3 @@ "use strict";

const addBar = (m) => m.foo == "foo" && Object.assign({}, m, bar);
const barIfFoo = (m) => m.foo == "foo" && bar;

@@ -929,3 +929,3 @@ const fooPlusBar = {

it("should complete and never emit on no match when 'else' router doesn't exist", (done) =>
ifMatches(addBar)
ifMatches(barIfFoo)
.thenDo(throwErr)

@@ -937,3 +937,3 @@ .route(notFoo)

it("should complete and never emit on no match when 'else' router doesn't exist", (done) =>
ifMatches(addBar)
ifMatches(barIfFoo)
.thenTry(Router.do(throwErr))

@@ -945,3 +945,3 @@ .route(notFoo)

it("should complete and never emit on no match when 'else' router doesn't route", (done) =>
ifMatches(addBar)
ifMatches(barIfFoo)
.thenDo(throwErr)

@@ -954,3 +954,3 @@ .elseTry(Router.no())

it("should complete and never emit on match when 'if' router doesn't route and 'else' router exists", (done) =>
ifMatches(addBar)
ifMatches(barIfFoo)
.thenTry(Router.no())

@@ -965,3 +965,3 @@ .elseDo(throwErr)

ifMatches(addBar)
ifMatches(barIfFoo)
.thenDo(m => {

@@ -980,3 +980,3 @@ routed = true;

ifMatches(addBar)
ifMatches(barIfFoo)
.thenDo(m => {

@@ -996,3 +996,3 @@ routed = true;

ifMatches(addBar)
ifMatches(barIfFoo)
.thenDo(throwErr)

@@ -1012,3 +1012,3 @@ .elseDo(m => {

ifMatches(addBar)
ifMatches(barIfFoo)
.thenDo(throwErr)

@@ -1026,3 +1026,3 @@ .elseTry(Router.do(m => {

it("should return score=1 when score not supplied", (done) => {
ifMatches(addBar)
ifMatches(barIfFoo)
.thenDo(m => {})

@@ -1060,3 +1060,3 @@ .getRoute(foo)

it("should return combined score when route score supplied", (done) => {
ifMatches(addBar)
ifMatches(barIfFoo)
.thenTry(Router.do(() => {}, .25))

@@ -1081,3 +1081,3 @@ .getRoute(foo)

it("should return 'else' route score on no match", (done) => {
ifMatches(addBar)
ifMatches(barIfFoo)
.thenDo(throwErr)

@@ -1091,2 +1091,59 @@ .elseTry(Router.do(() => {}, .5))

});
it("should transform an ifTrue result", (done) => {
let handled;
ifTrue(c => true)
.and(ifMatches(barIfFoo))
.thenDo((c, value) => {
handled = value;
})
.route(foo)
.subscribe(route => {
expect(handled.bar).to.eql("bar");
done();
});
});
it("should transform an ifTrue result with parameter", (done) => {
let handled;
ifTrue(c => true)
.and(value => ifMatches(barIfFoo))
.thenDo((c, value) => {
handled = value;
})
.route(foo)
.subscribe(route => {
expect(handled.bar).to.eql("bar");
done();
});
});
it("should transform an ifMatches result", (done) => {
let handled;
ifMatches(barIfFoo)
.and(ifMatches(c => ({ foobar: "foobar" })))
.thenDo((c, value) => {
handled = value;
})
.route(foo)
.subscribe(route => {
expect(handled.foobar).to.eql("foobar");
done();
});
});
it("should transform an ifMatches result with parameter", (done) => {
let handled;
ifMatches(barIfFoo)
.and(value => ifMatches(c => ({ foobar: value.bar })))
.thenDo((c, value) => {
handled = value;
})
.route(foo)
.subscribe(route => {
expect(handled.foobar).to.eql("bar");
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