@@ -168,6 +168,24 @@ export class ActionMetadata {
168168 this . methodOverride = args . methodOverride ;
169169 }
170170
171+ // -------------------------------------------------------------------------
172+ // Static Methods
173+ // -------------------------------------------------------------------------
174+
175+ /**
176+ * Appends base route to a given regexp route.
177+ */
178+ static appendBaseRoute ( baseRoute : string , route : RegExp | string ) {
179+ const prefix = `${ baseRoute . length > 0 && baseRoute . indexOf ( '/' ) < 0 ? '/' : '' } ${ baseRoute } ` ;
180+ if ( typeof route === 'string' ) return `${ prefix } ${ route } ` ;
181+
182+ if ( ! baseRoute || baseRoute === '' ) return route ;
183+
184+ const fullPath = `^${ prefix } ${ route . toString ( ) . substr ( 1 ) } ?$` ;
185+
186+ return new RegExp ( fullPath , route . flags ) ;
187+ }
188+
171189 // -------------------------------------------------------------------------
172190 // Public Methods
173191 // -------------------------------------------------------------------------
@@ -220,6 +238,20 @@ export class ActionMetadata {
220238 ) ;
221239 }
222240
241+ // -------------------------------------------------------------------------
242+ // Public Methods
243+ // -------------------------------------------------------------------------
244+
245+ /**
246+ * Calls action method.
247+ * Action method is an action defined in a user controller.
248+ */
249+ callMethod ( params : any [ ] , action : Action ) {
250+ const controllerInstance = this . controllerMetadata . getInstance ( action ) ;
251+ // eslint-disable-next-line prefer-spread
252+ return controllerInstance [ this . method ] . apply ( controllerInstance , params ) ;
253+ }
254+
223255 // -------------------------------------------------------------------------
224256 // Private Methods
225257 // -------------------------------------------------------------------------
@@ -259,34 +291,4 @@ export class ActionMetadata {
259291 return headers ;
260292 }
261293
262- // -------------------------------------------------------------------------
263- // Public Methods
264- // -------------------------------------------------------------------------
265-
266- /**
267- * Calls action method.
268- * Action method is an action defined in a user controller.
269- */
270- callMethod ( params : any [ ] , action : Action ) {
271- const controllerInstance = this . controllerMetadata . getInstance ( action ) ;
272- return controllerInstance [ this . method ] . apply ( controllerInstance , params ) ;
273- }
274-
275- // -------------------------------------------------------------------------
276- // Static Methods
277- // -------------------------------------------------------------------------
278-
279- /**
280- * Appends base route to a given regexp route.
281- */
282- static appendBaseRoute ( baseRoute : string , route : RegExp | string ) {
283- const prefix = `${ baseRoute . length > 0 && baseRoute . indexOf ( '/' ) < 0 ? '/' : '' } ${ baseRoute } ` ;
284- if ( typeof route === 'string' ) return `${ prefix } ${ route } ` ;
285-
286- if ( ! baseRoute || baseRoute === '' ) return route ;
287-
288- const fullPath = `^${ prefix } ${ route . toString ( ) . substr ( 1 ) } ?$` ;
289-
290- return new RegExp ( fullPath , route . flags ) ;
291- }
292294}
0 commit comments