@tinkoff/router 0.2.10 → 0.2.12
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/lib/tree/constants.browser.js +2 -1
- package/lib/tree/constants.d.ts +1 -0
- package/lib/tree/constants.es.js +2 -1
- package/lib/tree/constants.js +2 -0
- package/lib/tree/utils.browser.js +2 -2
- package/lib/tree/utils.d.ts +1 -1
- package/lib/tree/utils.es.js +2 -2
- package/lib/tree/utils.js +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const PARAMETER_DELIMITER = ':';
|
|
2
2
|
const WILDCARD_REGEXP = /\*/;
|
|
3
3
|
const HISTORY_FALLBACK_REGEXP = /<history-fallback>/;
|
|
4
|
+
const PARAM_MATCH_REGEXP = /:.+$/;
|
|
4
5
|
const PARAM_PARSER_REGEXP = /([^(?]+)(?:\((.+)\))?(\?)?/;
|
|
5
6
|
|
|
6
|
-
export { HISTORY_FALLBACK_REGEXP, PARAMETER_DELIMITER, PARAM_PARSER_REGEXP, WILDCARD_REGEXP };
|
|
7
|
+
export { HISTORY_FALLBACK_REGEXP, PARAMETER_DELIMITER, PARAM_MATCH_REGEXP, PARAM_PARSER_REGEXP, WILDCARD_REGEXP };
|
package/lib/tree/constants.d.ts
CHANGED
package/lib/tree/constants.es.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const PARAMETER_DELIMITER = ':';
|
|
2
2
|
const WILDCARD_REGEXP = /\*/;
|
|
3
3
|
const HISTORY_FALLBACK_REGEXP = /<history-fallback>/;
|
|
4
|
+
const PARAM_MATCH_REGEXP = /:.+$/;
|
|
4
5
|
const PARAM_PARSER_REGEXP = /([^(?]+)(?:\((.+)\))?(\?)?/;
|
|
5
6
|
|
|
6
|
-
export { HISTORY_FALLBACK_REGEXP, PARAMETER_DELIMITER, PARAM_PARSER_REGEXP, WILDCARD_REGEXP };
|
|
7
|
+
export { HISTORY_FALLBACK_REGEXP, PARAMETER_DELIMITER, PARAM_MATCH_REGEXP, PARAM_PARSER_REGEXP, WILDCARD_REGEXP };
|
package/lib/tree/constants.js
CHANGED
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const PARAMETER_DELIMITER = ':';
|
|
6
6
|
const WILDCARD_REGEXP = /\*/;
|
|
7
7
|
const HISTORY_FALLBACK_REGEXP = /<history-fallback>/;
|
|
8
|
+
const PARAM_MATCH_REGEXP = /:.+$/;
|
|
8
9
|
const PARAM_PARSER_REGEXP = /([^(?]+)(?:\((.+)\))?(\?)?/;
|
|
9
10
|
|
|
10
11
|
exports.HISTORY_FALLBACK_REGEXP = HISTORY_FALLBACK_REGEXP;
|
|
11
12
|
exports.PARAMETER_DELIMITER = PARAMETER_DELIMITER;
|
|
13
|
+
exports.PARAM_MATCH_REGEXP = PARAM_MATCH_REGEXP;
|
|
12
14
|
exports.PARAM_PARSER_REGEXP = PARAM_PARSER_REGEXP;
|
|
13
15
|
exports.WILDCARD_REGEXP = WILDCARD_REGEXP;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import map from '@tinkoff/utils/array/map';
|
|
2
|
-
import { HISTORY_FALLBACK_REGEXP, WILDCARD_REGEXP, PARAMETER_DELIMITER, PARAM_PARSER_REGEXP } from './constants.browser.js';
|
|
2
|
+
import { HISTORY_FALLBACK_REGEXP, WILDCARD_REGEXP, PARAM_MATCH_REGEXP, PARAMETER_DELIMITER, PARAM_PARSER_REGEXP } from './constants.browser.js';
|
|
3
3
|
import { normalizeTrailingSlash } from '../utils.browser.js';
|
|
4
4
|
|
|
5
5
|
const getParts = (pathname) => pathname
|
|
@@ -12,7 +12,7 @@ const isWildcard = (part) => {
|
|
|
12
12
|
return WILDCARD_REGEXP.test(part);
|
|
13
13
|
};
|
|
14
14
|
const isParameterized = (part) => {
|
|
15
|
-
return part.
|
|
15
|
+
return part.match(PARAM_MATCH_REGEXP);
|
|
16
16
|
};
|
|
17
17
|
const parseParameter = (part) => {
|
|
18
18
|
const [prefix = '', param, postfix = ''] = part.split(PARAMETER_DELIMITER);
|
package/lib/tree/utils.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ import type { Params } from '../types';
|
|
|
3
3
|
export declare const getParts: (pathname: string) => string[];
|
|
4
4
|
export declare const isHistoryFallback: (part: string) => boolean;
|
|
5
5
|
export declare const isWildcard: (part: string) => boolean;
|
|
6
|
-
export declare const isParameterized: (part: string) =>
|
|
6
|
+
export declare const isParameterized: (part: string) => RegExpMatchArray;
|
|
7
7
|
export declare const parse: (part: string) => ParsedPath;
|
|
8
8
|
export declare const makePath: (pathname: string, params: Params) => string;
|
package/lib/tree/utils.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import map from '@tinkoff/utils/array/map';
|
|
2
|
-
import { HISTORY_FALLBACK_REGEXP, WILDCARD_REGEXP, PARAMETER_DELIMITER, PARAM_PARSER_REGEXP } from './constants.es.js';
|
|
2
|
+
import { HISTORY_FALLBACK_REGEXP, WILDCARD_REGEXP, PARAM_MATCH_REGEXP, PARAMETER_DELIMITER, PARAM_PARSER_REGEXP } from './constants.es.js';
|
|
3
3
|
import { normalizeTrailingSlash } from '../utils.es.js';
|
|
4
4
|
|
|
5
5
|
const getParts = (pathname) => pathname
|
|
@@ -12,7 +12,7 @@ const isWildcard = (part) => {
|
|
|
12
12
|
return WILDCARD_REGEXP.test(part);
|
|
13
13
|
};
|
|
14
14
|
const isParameterized = (part) => {
|
|
15
|
-
return part.
|
|
15
|
+
return part.match(PARAM_MATCH_REGEXP);
|
|
16
16
|
};
|
|
17
17
|
const parseParameter = (part) => {
|
|
18
18
|
const [prefix = '', param, postfix = ''] = part.split(PARAMETER_DELIMITER);
|
package/lib/tree/utils.js
CHANGED
|
@@ -20,7 +20,7 @@ const isWildcard = (part) => {
|
|
|
20
20
|
return constants.WILDCARD_REGEXP.test(part);
|
|
21
21
|
};
|
|
22
22
|
const isParameterized = (part) => {
|
|
23
|
-
return part.
|
|
23
|
+
return part.match(constants.PARAM_MATCH_REGEXP);
|
|
24
24
|
};
|
|
25
25
|
const parseParameter = (part) => {
|
|
26
26
|
const [prefix = '', param, postfix = ''] = part.split(constants.PARAMETER_DELIMITER);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinkoff/router",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "router",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"watch": "tsc -w"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tinkoff/react-hooks": "0.1.
|
|
25
|
-
"@tinkoff/url": "0.8.
|
|
24
|
+
"@tinkoff/react-hooks": "0.1.6",
|
|
25
|
+
"@tinkoff/url": "0.8.6",
|
|
26
26
|
"@tinkoff/utils": "^2.1.2",
|
|
27
27
|
"use-sync-external-store": "^1.2.0"
|
|
28
28
|
},
|