improvement - matchPath operator - added regexpt pattern matching
MODIFY
package-lock.json
package-lock.json
"integrity": "sha512-FM7tvbjbn2BUzM/Qsdk9LUGq3zeh7li8NcHoS398dBzqLzfmSqSP1+yKbMRTCcZzLcu2JAR5lq3IKIEYkto7iQ==",
"dev": true
},
+ "@types/path-to-regexp": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/@types/path-to-regexp/-/path-to-regexp-1.7.0.tgz",
+ "integrity": "sha1-8a+dnJ21+K2AqnXtQk22ZcSNbNQ=",
+ "requires": {
+ "path-to-regexp": "2.2.1"
+ }
+ },
"@types/shelljs": {
"version": "0.7.8",
"resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.7.8.tgz",
"integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=",
"dev": true
},
+ "path-to-regexp": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.2.1.tgz",
+ "integrity": "sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ=="
+ },
"path-type": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",

MODIFY
package.json
package.json
"homepage": "https://github.com/JozefFlakus/node-rx#readme",
"dependencies": {
"@types/chalk": "^2.2.0",
+ "@types/path-to-regexp": "^1.7.0",
"chalk": "^2.4.1",
+ "path-to-regexp": "^2.2.1",
"rxjs": "~6.0.0"
},
"devDependencies": {

MODIFY
src/operators/matchPath.operator.ts
src/operators/matchPath.operator.ts
+import * as pathToRegexp from 'path-to-regexp';
import { Observable } from 'rxjs';
import { filter } from 'rxjs/operators';
import { HttpRequest } from '../http.interface';
export const matchPath = (path: string) => (source$: Observable<HttpRequest>) =>
source$.pipe(
- filter(req => req.url === path)
+ filter(req => pathToRegexp(path).test(req.url!))
);

improvement - matchPath operator - added regexpt pattern matching