@marianmeres/simple-router 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -175,6 +175,13 @@ class SimpleRouter {
175
175
  _dbg(...a) {
176
176
  SimpleRouter.debug && console.log('[SimpleRouter]', ...a);
177
177
  }
178
+ /** Will report map of registered routes and their labels. Intended for debugging. */
179
+ info() {
180
+ return this._routes.reduce((m, r) => {
181
+ m[r[0].route] = r[3];
182
+ return m;
183
+ }, {});
184
+ }
178
185
  reset() {
179
186
  this._routes = [];
180
187
  return this;
package/dist/index.js CHANGED
@@ -173,6 +173,13 @@ class SimpleRouter {
173
173
  _dbg(...a) {
174
174
  SimpleRouter.debug && console.log('[SimpleRouter]', ...a);
175
175
  }
176
+ /** Will report map of registered routes and their labels. Intended for debugging. */
177
+ info() {
178
+ return this._routes.reduce((m, r) => {
179
+ m[r[0].route] = r[3];
180
+ return m;
181
+ }, {});
182
+ }
176
183
  reset() {
177
184
  this._routes = [];
178
185
  return this;
package/dist/router.d.ts CHANGED
@@ -13,6 +13,8 @@ export declare class SimpleRouter {
13
13
  [route: string]: Function;
14
14
  });
15
15
  protected _dbg(...a: any[]): void;
16
+ /** Will report map of registered routes and their labels. Intended for debugging. */
17
+ info(): Record<string, string>;
16
18
  reset(): this;
17
19
  get current(): {
18
20
  route: string;
package/package.json CHANGED
@@ -1,50 +1,51 @@
1
1
  {
2
- "name": "@marianmeres/simple-router",
3
- "version": "2.0.1",
4
- "description": "Minimalistic route parser for sapper-like regex routes",
5
- "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "exports": {
9
- "require": "./dist/index.cjs",
10
- "import": "./dist/index.js"
11
- },
12
- "types": "./dist/index.d.ts",
13
- "files": [
14
- "dist"
15
- ],
16
- "scripts": {
17
- "clean": "rimraf dist/*",
18
- "build": "npm run clean && rollup -c",
19
- "dev": "npm run clean && rollup -c -w",
20
- "prettier": "prettier --write \"{src,tests,examples}/**/*.{js,ts,json}\"",
21
- "release": "release",
22
- "test": "test-runner",
23
- "test:watch": "nodemon -q -w dist -w tests -x test-runner --"
24
- },
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/marianmeres/simple-router.git"
28
- },
29
- "keywords": [
30
- "router"
31
- ],
32
- "author": "Marian Meres <marian@meres.sk>",
33
- "license": "WTFPL",
34
- "bugs": {
35
- "url": "https://github.com/marianmeres/simple-router/issues"
36
- },
37
- "homepage": "https://github.com/marianmeres/simple-router#readme",
38
- "devDependencies": {
39
- "@marianmeres/release": "^0.0.7",
40
- "@marianmeres/test-runner": "^2.0.8",
41
- "@rollup/plugin-typescript": "^9.0.2",
42
- "@types/node": "^14.18.33",
43
- "lodash": "^4.17.21",
44
- "prettier": "^2.2.1",
45
- "rimraf": "^3.0.2",
46
- "rollup": "^3.3.0",
47
- "tslib": "^2.4.1",
48
- "typescript": "^4.8.4"
49
- }
2
+ "name": "@marianmeres/simple-router",
3
+ "version": "2.1.0",
4
+ "description": "Minimalistic route parser for sapper-like regex routes",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "exports": {
9
+ "require": "./dist/index.cjs",
10
+ "import": "./dist/index.js"
11
+ },
12
+ "types": "./dist/index.d.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "clean": "rimraf dist/*",
18
+ "build": "npm run clean && rollup -c",
19
+ "dev": "npm run clean && rollup -c -w",
20
+ "prettier": "prettier --write \"{src,tests,examples}/**/*.{js,ts,json}\"",
21
+ "release": "release -v minor",
22
+ "release:patch": "release -v patch",
23
+ "test": "test-runner",
24
+ "test:watch": "nodemon -q -w dist -w tests -x test-runner --"
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/marianmeres/simple-router.git"
29
+ },
30
+ "keywords": [
31
+ "router"
32
+ ],
33
+ "author": "Marian Meres <marian@meres.sk>",
34
+ "license": "WTFPL",
35
+ "bugs": {
36
+ "url": "https://github.com/marianmeres/simple-router/issues"
37
+ },
38
+ "homepage": "https://github.com/marianmeres/simple-router#readme",
39
+ "devDependencies": {
40
+ "@marianmeres/release": "^1.1.2",
41
+ "@marianmeres/test-runner": "^2.0.8",
42
+ "@rollup/plugin-typescript": "^9.0.2",
43
+ "@types/node": "^14.18.33",
44
+ "lodash": "^4.17.21",
45
+ "prettier": "^2.2.1",
46
+ "rimraf": "^3.0.2",
47
+ "rollup": "^3.3.0",
48
+ "tslib": "^2.4.1",
49
+ "typescript": "^4.8.4"
50
+ }
50
51
  }