@bool-ts/core 1.8.1 → 1.8.2
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/__test/controller.ts +1 -1
- package/__test/dispatcher.ts +2 -2
- package/__test/firstGuard.ts +3 -1
- package/__test/firstMiddleware.ts +3 -2
- package/__test/index.ts +1 -1
- package/__test/module.ts +1 -1
- package/__test/repository.ts +2 -3
- package/__test/secondGuard.ts +1 -1
- package/__test/secondMiddleware.ts +2 -2
- package/__test/service.ts +4 -7
- package/__test/tsconfig.json +6 -2
- package/__test/webSocket.ts +1 -1
- package/dist/index.js +4995 -6
- package/package.json +2 -2
- package/dist/decorators/arguments.js +0 -123
- package/dist/decorators/controller.js +0 -9
- package/dist/decorators/dispatcher.js +0 -6
- package/dist/decorators/guard.js +0 -9
- package/dist/decorators/http.js +0 -60
- package/dist/decorators/index.js +0 -13
- package/dist/decorators/inject.js +0 -9
- package/dist/decorators/injectable.js +0 -3
- package/dist/decorators/middleware.js +0 -6
- package/dist/decorators/module.js +0 -48
- package/dist/decorators/webSocket.js +0 -40
- package/dist/decorators/webSocketArguments.js +0 -49
- package/dist/decorators/webSocketEvent.js +0 -24
- package/dist/decorators/zodSchema.js +0 -15
- package/dist/entities/httpRoute.js +0 -268
- package/dist/entities/httpRouter.js +0 -27
- package/dist/entities/httpRouterGroup.js +0 -24
- package/dist/entities/index.js +0 -6
- package/dist/entities/webSocketRoute.js +0 -22
- package/dist/entities/webSocketRouter.js +0 -54
- package/dist/entities/webSocketRouterGroup.js +0 -51
- package/dist/hooks/factory.js +0 -1072
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/injector.js +0 -36
- package/dist/http/clientError.js +0 -42
- package/dist/http/index.js +0 -40
- package/dist/http/serverError.js +0 -24
- package/dist/interfaces/context.js +0 -1
- package/dist/interfaces/controller.js +0 -1
- package/dist/interfaces/dispatcher.js +0 -1
- package/dist/interfaces/guard.js +0 -1
- package/dist/interfaces/index.js +0 -1
- package/dist/interfaces/middleware.js +0 -1
- package/dist/interfaces/module.js +0 -1
- package/dist/interfaces/webSocket.js +0 -1
- package/dist/keys/index.js +0 -31
- package/dist/ultils/asyncFunction.js +0 -1
- package/dist/ultils/colors.js +0 -41
- package/dist/ultils/index.js +0 -3
- package/dist/ultils/socket.js +0 -7
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
export class HttpRoute {
|
|
3
|
-
static rootPattern = ":([a-z0-9A-Z_-]{1,})";
|
|
4
|
-
static innerRootPattern = "([a-z0-9A-Z_-]{1,})";
|
|
5
|
-
alias;
|
|
6
|
-
_map = new Map();
|
|
7
|
-
constructor(alias) {
|
|
8
|
-
this.alias = this._thinAlias(alias);
|
|
9
|
-
}
|
|
10
|
-
test(pathname, method) {
|
|
11
|
-
try {
|
|
12
|
-
const model = this._map.get(method);
|
|
13
|
-
const aliasSplitted = this.alias.split("/");
|
|
14
|
-
const currentPathNameSplitted = this._thinAlias(pathname).split("/");
|
|
15
|
-
if (!model) {
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
// Compare splitted length
|
|
19
|
-
if (aliasSplitted.length !== currentPathNameSplitted.length) {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
const parameters = Object();
|
|
23
|
-
const matchingRegex = this.alias.replace(new RegExp(HttpRoute.rootPattern, "g"), HttpRoute.innerRootPattern);
|
|
24
|
-
if (!new RegExp(matchingRegex).test(this._thinAlias(pathname))) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
for (let index = 0; index < aliasSplitted.length; index++) {
|
|
28
|
-
const aliasPart = aliasSplitted[index];
|
|
29
|
-
const pathnamePart = currentPathNameSplitted[index];
|
|
30
|
-
// Check pathmane path match a dynamic syntax, if no match => start compare equal or not
|
|
31
|
-
if (!new RegExp(HttpRoute.rootPattern, "g").test(aliasPart)) {
|
|
32
|
-
if (aliasPart !== pathnamePart)
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
let isFailed = false;
|
|
37
|
-
aliasPart.replace(new RegExp(HttpRoute.rootPattern, "g"), (match, key, offset) => {
|
|
38
|
-
if (offset === 0) {
|
|
39
|
-
pathnamePart.replace(new RegExp(HttpRoute.innerRootPattern, "g"), (innerMatch, innerKey, innerOffset) => {
|
|
40
|
-
if (innerOffset === 0) {
|
|
41
|
-
Object.assign(parameters, {
|
|
42
|
-
[key]: innerMatch
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return innerMatch;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
return match;
|
|
49
|
-
});
|
|
50
|
-
if (isFailed) {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
return Object.freeze({
|
|
57
|
-
parameters: parameters,
|
|
58
|
-
model: model
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
console.error(err);
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
|
-
isMatch(pathname, method) {
|
|
70
|
-
try {
|
|
71
|
-
const handlers = this._map.get(method);
|
|
72
|
-
if (!handlers) {
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
75
|
-
const aliasSplitted = this.alias.split("/");
|
|
76
|
-
const currentPathNameSplitted = this._thinAlias(pathname).split("/");
|
|
77
|
-
// Compare splitted length
|
|
78
|
-
if (aliasSplitted.length !== currentPathNameSplitted.length) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
const parameters = Object();
|
|
82
|
-
for (let index = 0; index < aliasSplitted.length; index++) {
|
|
83
|
-
const aliasPart = aliasSplitted[index];
|
|
84
|
-
const pathnamePart = currentPathNameSplitted[index];
|
|
85
|
-
// Check pathmane path match a dynamic syntax, if no match => start compare equal or not
|
|
86
|
-
if (!new RegExp(HttpRoute.rootPattern, "g").test(aliasPart)) {
|
|
87
|
-
if (aliasPart !== pathnamePart) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
let isFailed = false;
|
|
93
|
-
aliasPart.replace(new RegExp(HttpRoute.rootPattern, "g"), (subString, key, value) => {
|
|
94
|
-
if (!new RegExp(value, "g").test(pathnamePart)) {
|
|
95
|
-
isFailed = true;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
Object.assign(parameters, {
|
|
99
|
-
[key]: pathnamePart
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
return "";
|
|
103
|
-
});
|
|
104
|
-
if (isFailed) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
catch (err) {
|
|
113
|
-
console.error(err);
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
*
|
|
119
|
-
* @param handlers
|
|
120
|
-
* @returns
|
|
121
|
-
*/
|
|
122
|
-
get(handler) {
|
|
123
|
-
const currenTHttpRouteModel = this._map.get("GET");
|
|
124
|
-
if (!currenTHttpRouteModel) {
|
|
125
|
-
this._map.set("GET", handler);
|
|
126
|
-
}
|
|
127
|
-
return this;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
*
|
|
131
|
-
* @param handlers
|
|
132
|
-
* @returns
|
|
133
|
-
*/
|
|
134
|
-
post(handler) {
|
|
135
|
-
const currenTHttpRouteModel = this._map.get("POST");
|
|
136
|
-
if (!currenTHttpRouteModel) {
|
|
137
|
-
this._map.set("POST", handler);
|
|
138
|
-
}
|
|
139
|
-
return this;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
*
|
|
143
|
-
* @param handlers
|
|
144
|
-
* @returns
|
|
145
|
-
*/
|
|
146
|
-
put(handler) {
|
|
147
|
-
const currenTHttpRouteModel = this._map.get("PUT");
|
|
148
|
-
if (!currenTHttpRouteModel) {
|
|
149
|
-
this._map.set("PUT", handler);
|
|
150
|
-
}
|
|
151
|
-
return this;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
*
|
|
155
|
-
* @param handlers
|
|
156
|
-
* @returns
|
|
157
|
-
*/
|
|
158
|
-
delete(handler) {
|
|
159
|
-
const currenTHttpRouteModel = this._map.get("DELETE");
|
|
160
|
-
if (!currenTHttpRouteModel) {
|
|
161
|
-
this._map.set("DELETE", handler);
|
|
162
|
-
}
|
|
163
|
-
return this;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
*
|
|
167
|
-
* @param handlers
|
|
168
|
-
* @returns
|
|
169
|
-
*/
|
|
170
|
-
connect(handler) {
|
|
171
|
-
const currenTHttpRouteModel = this._map.get("CONNECT");
|
|
172
|
-
if (!currenTHttpRouteModel) {
|
|
173
|
-
return this._map.set("CONNECT", handler);
|
|
174
|
-
}
|
|
175
|
-
return this;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
*
|
|
179
|
-
* @param handlers
|
|
180
|
-
* @returns
|
|
181
|
-
*/
|
|
182
|
-
options(handler) {
|
|
183
|
-
const currenTHttpRouteModel = this._map.get("OPTIONS");
|
|
184
|
-
if (!currenTHttpRouteModel) {
|
|
185
|
-
return this._map.set("OPTIONS", handler);
|
|
186
|
-
}
|
|
187
|
-
return this;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
*
|
|
191
|
-
* @param handlers
|
|
192
|
-
* @returns
|
|
193
|
-
*/
|
|
194
|
-
trace(handler) {
|
|
195
|
-
const currenTHttpRouteModel = this._map.get("TRACE");
|
|
196
|
-
if (!currenTHttpRouteModel) {
|
|
197
|
-
return this._map.set("TRACE", handler);
|
|
198
|
-
}
|
|
199
|
-
return this;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
*
|
|
203
|
-
* @param handlers
|
|
204
|
-
* @returns
|
|
205
|
-
*/
|
|
206
|
-
patch(handler) {
|
|
207
|
-
const currenTHttpRouteModel = this._map.get("PATCH");
|
|
208
|
-
if (!currenTHttpRouteModel) {
|
|
209
|
-
return this._map.set("PATCH", handler);
|
|
210
|
-
}
|
|
211
|
-
return this;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
*
|
|
215
|
-
* @param handlers
|
|
216
|
-
* @returns
|
|
217
|
-
*/
|
|
218
|
-
_thinAlias(alias) {
|
|
219
|
-
return alias
|
|
220
|
-
.replace(new RegExp("[/]{2,}", "g"), "/")
|
|
221
|
-
.replace(new RegExp("^[/]|[/]$", "g"), "");
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Internal get fullpath after check regular expression
|
|
225
|
-
* @returns
|
|
226
|
-
*/
|
|
227
|
-
get _fullPath() {
|
|
228
|
-
// Split path to start filter
|
|
229
|
-
const pathSplited = this.alias.split("/");
|
|
230
|
-
const blockFiltered = pathSplited.map((value, index) => {
|
|
231
|
-
// Initialize full parameter regex to validate
|
|
232
|
-
let validateReg = new RegExp(":([a-z0-9A-Z_.-]{1,})(\\(.*?\\))", "g");
|
|
233
|
-
if (!validateReg.test(value)) {
|
|
234
|
-
// Initialize key parameter regex to validate
|
|
235
|
-
validateReg = new RegExp(":([a-z0-9A-Z_.-]{1,})", "g");
|
|
236
|
-
if (!validateReg.test(value)) {
|
|
237
|
-
return value;
|
|
238
|
-
}
|
|
239
|
-
return value.replace(validateReg, (value, index) => `${value}(.*?)`);
|
|
240
|
-
}
|
|
241
|
-
return value;
|
|
242
|
-
});
|
|
243
|
-
return blockFiltered.join("/");
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Internal get filterd path after check regular expression
|
|
247
|
-
* @returns
|
|
248
|
-
*/
|
|
249
|
-
get _filteredPath() {
|
|
250
|
-
// Split path to start filter
|
|
251
|
-
const pathSplited = this.alias.split("/");
|
|
252
|
-
//
|
|
253
|
-
const blockFiltered = pathSplited.map((value, index) => {
|
|
254
|
-
let validateReg = new RegExp(":([a-z0-9A-Z_.-]{1,})((.*?))", "g");
|
|
255
|
-
if (!validateReg.test(value)) {
|
|
256
|
-
// Initialize key parameter regex to validate
|
|
257
|
-
validateReg = new RegExp(":([a-z0-9A-Z_.-]{1,})", "g");
|
|
258
|
-
if (!validateReg.test(value)) {
|
|
259
|
-
return value;
|
|
260
|
-
}
|
|
261
|
-
return value.replace(validateReg, (value, index) => "(.*?)");
|
|
262
|
-
}
|
|
263
|
-
return value.replace(validateReg, (subString, arg_01, arg_02) => arg_02);
|
|
264
|
-
});
|
|
265
|
-
return blockFiltered.join("/");
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
export default HttpRoute;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import HttpRoute from "./httpRoute";
|
|
3
|
-
export class HttpRouter {
|
|
4
|
-
alias;
|
|
5
|
-
_routes = new Map();
|
|
6
|
-
constructor(alias) {
|
|
7
|
-
this.alias = this._thinAlias(alias);
|
|
8
|
-
}
|
|
9
|
-
route(alias) {
|
|
10
|
-
const thinAlias = this._thinAlias(`${this.alias}/${alias}`);
|
|
11
|
-
const route = this._routes.get(thinAlias);
|
|
12
|
-
const newRoute = !route ? new HttpRoute(`${this.alias}/${alias}`) : route;
|
|
13
|
-
if (!route) {
|
|
14
|
-
this._routes.set(thinAlias, newRoute);
|
|
15
|
-
}
|
|
16
|
-
return newRoute;
|
|
17
|
-
}
|
|
18
|
-
_thinAlias(alias) {
|
|
19
|
-
return alias
|
|
20
|
-
.replace(new RegExp("[/]{2,}", "g"), "/")
|
|
21
|
-
.replace(new RegExp("^[/]|[/]$", "g"), "");
|
|
22
|
-
}
|
|
23
|
-
get routes() {
|
|
24
|
-
return this._routes;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export default HttpRouter;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export class HttpRouterGroup {
|
|
2
|
-
_routers = new Map();
|
|
3
|
-
add(...routers) {
|
|
4
|
-
for (let i = 0; i < routers.length; i++) {
|
|
5
|
-
if (this._routers.has(routers[i].alias)) {
|
|
6
|
-
continue;
|
|
7
|
-
}
|
|
8
|
-
this._routers.set(routers[i].alias, routers[i]);
|
|
9
|
-
}
|
|
10
|
-
return this;
|
|
11
|
-
}
|
|
12
|
-
find(pathame, method) {
|
|
13
|
-
for (const router of [...this._routers.values()]) {
|
|
14
|
-
for (const route of router.routes.values()) {
|
|
15
|
-
const result = route.test(pathame, method);
|
|
16
|
-
if (!result) {
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
}
|
package/dist/entities/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { HttpRoute } from "./httpRoute";
|
|
2
|
-
export { HttpRouter } from "./httpRouter";
|
|
3
|
-
export { HttpRouterGroup } from "./httpRouterGroup";
|
|
4
|
-
export { WebSocketRoute } from "./webSocketRoute";
|
|
5
|
-
export { WebSocketRouter } from "./webSocketRouter";
|
|
6
|
-
export { WebSocketRouterGroup } from "./webSocketRouterGroup";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export class WebSocketRoute {
|
|
2
|
-
eventName;
|
|
3
|
-
metadata;
|
|
4
|
-
_context = undefined;
|
|
5
|
-
constructor({ eventName, metadata }) {
|
|
6
|
-
this.eventName = eventName;
|
|
7
|
-
this.metadata = metadata;
|
|
8
|
-
}
|
|
9
|
-
bind(instance) {
|
|
10
|
-
this._context = instance;
|
|
11
|
-
return this;
|
|
12
|
-
}
|
|
13
|
-
execute() {
|
|
14
|
-
return Object.freeze({
|
|
15
|
-
methodName: this.metadata.methodName,
|
|
16
|
-
descriptor: !this._context || typeof this.metadata.descriptor.value !== "function"
|
|
17
|
-
? this.metadata.descriptor
|
|
18
|
-
: this.metadata.descriptor.value.bind(this._context),
|
|
19
|
-
arguments: this.metadata.arguments
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export class WebSocketRouter {
|
|
2
|
-
rawAlias;
|
|
3
|
-
alias;
|
|
4
|
-
routes = [];
|
|
5
|
-
constructor(rawAlias = "/") {
|
|
6
|
-
this.rawAlias = rawAlias;
|
|
7
|
-
this.alias = WebSocketRouter.thinAlias(rawAlias);
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Add websocket routes into router and start analysis
|
|
11
|
-
* @param routes
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
addRoutes(...routes) {
|
|
15
|
-
for (const route of routes) {
|
|
16
|
-
if (!this.routes.includes(route)) {
|
|
17
|
-
this.routes.push(route);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Bind context for descriptor handler in the router
|
|
24
|
-
* @param instance
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
bind(instance) {
|
|
28
|
-
for (const route of this.routes) {
|
|
29
|
-
route.bind(instance);
|
|
30
|
-
}
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Generate map for websocket handler metadata
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
execute() {
|
|
38
|
-
const map = new Map();
|
|
39
|
-
for (const route of this.routes) {
|
|
40
|
-
map.set(`${this.alias}:::${route.eventName}`, route.execute());
|
|
41
|
-
}
|
|
42
|
-
return map;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Handle alias for router, standardize
|
|
46
|
-
* @param alias
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
static thinAlias(alias) {
|
|
50
|
-
return alias
|
|
51
|
-
.replace(new RegExp("[/]{2,}", "g"), "/")
|
|
52
|
-
.replace(new RegExp("^[/]|[/]$", "g"), "");
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export class WebSocketRouterGroup {
|
|
2
|
-
rawPrefix;
|
|
3
|
-
prefix;
|
|
4
|
-
routers = [];
|
|
5
|
-
constructor(rawPrefix = "/") {
|
|
6
|
-
this.rawPrefix = rawPrefix;
|
|
7
|
-
this.prefix = WebSocketRouterGroup.thinPrefix(rawPrefix);
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* @param routers
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
addRouters(...routers) {
|
|
15
|
-
for (let i = 0; i < routers.length; i++) {
|
|
16
|
-
if (!this.routers.includes(routers[i])) {
|
|
17
|
-
this.routers.push(routers[i]);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
for (const router of routers) {
|
|
21
|
-
if (!this.routers.includes(router)) {
|
|
22
|
-
this.routers.push(router);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return this;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
execute() {
|
|
32
|
-
const map = new Map();
|
|
33
|
-
for (const router of this.routers) {
|
|
34
|
-
const routerMap = router.execute();
|
|
35
|
-
for (const [routerKey, metadata] of routerMap.entries()) {
|
|
36
|
-
map.set(`/${WebSocketRouterGroup.thinPrefix(`${this.prefix}/${routerKey}`)}`, metadata);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return map;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @param prefix
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
static thinPrefix(prefix) {
|
|
47
|
-
return prefix
|
|
48
|
-
.replace(new RegExp("[/]{2,}", "g"), "/")
|
|
49
|
-
.replace(new RegExp("^[/]|[/]$", "g"), "");
|
|
50
|
-
}
|
|
51
|
-
}
|