File tree Expand file tree Collapse file tree
packages/microservices/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { isString , isObject } from '@nestjs/common/utils/shared.utils' ;
2+ import * as Interfaces from '../interfaces' ;
23
34export class MsvcUtil {
45
56 /**
67 * Transforms the Pattern to Route.
78 * 1. If Pattern is a `string`, it will be returned as it is.
8- * 2. If Pattern is a `JSON` object, it will be transformed to Route. For that end,
9+ * 2. If Pattern is a `number`, it will be converted to `string`.
10+ * 3. If Pattern is a `JSON` object, it will be transformed to Route. For that end,
911 * the function will sort properties of `JSON` Object and creates `route` string
1012 * according to the following template:
1113 * <key1>:<value1>/<key2>:<value2>/.../<keyN>:<valueN>
@@ -14,9 +16,9 @@ export class MsvcUtil {
1416 * @returns string
1517 */
1618 public static transformPatternToRoute ( pattern : Interfaces . MsPattern ) : string {
17- // Returns the pattern according to the 1st
18- if ( isString ( pattern ) ) {
19- return pattern ;
19+ // Returns the pattern according to the 1st and the 2nd points
20+ if ( isString ( pattern ) || typeof pattern === 'number' ) {
21+ return ` ${ pattern } ` ;
2022 }
2123
2224 // Throws the error if the pattern has an incorrect type
You can’t perform that action at this time.
0 commit comments