@@ -108,8 +108,8 @@ proto.param = function param(name, fn) {
108108 var ret ;
109109
110110 if ( name [ 0 ] === ':' ) {
111- deprecate ( 'router.param(' + JSON . stringify ( name ) + ', fn): Use router.param(' + JSON . stringify ( name . substr ( 1 ) ) + ', fn) instead' ) ;
112- name = name . substr ( 1 ) ;
111+ deprecate ( 'router.param(' + JSON . stringify ( name ) + ', fn): Use router.param(' + JSON . stringify ( name . slice ( 1 ) ) + ', fn) instead' )
112+ name = name . slice ( 1 )
113113 }
114114
115115 for ( var i = 0 ; i < len ; ++ i ) {
@@ -180,14 +180,14 @@ proto.handle = function handle(req, res, out) {
180180
181181 // remove added slash
182182 if ( slashAdded ) {
183- req . url = req . url . substr ( 1 ) ;
183+ req . url = req . url . slice ( 1 )
184184 slashAdded = false ;
185185 }
186186
187187 // restore altered req.url
188188 if ( removed . length !== 0 ) {
189189 req . baseUrl = parentUrl ;
190- req . url = protohost + removed + req . url . substr ( protohost . length ) ;
190+ req . url = protohost + removed + req . url . slice ( protohost . length )
191191 removed = '' ;
192192 }
193193
@@ -288,7 +288,7 @@ proto.handle = function handle(req, res, out) {
288288 function trim_prefix ( layer , layerError , layerPath , path ) {
289289 if ( layerPath . length !== 0 ) {
290290 // Validate path is a prefix match
291- if ( layerPath !== path . substr ( 0 , layerPath . length ) ) {
291+ if ( layerPath !== path . slice ( 0 , layerPath . length ) ) {
292292 next ( layerError )
293293 return
294294 }
@@ -301,7 +301,7 @@ proto.handle = function handle(req, res, out) {
301301 // middleware (.use stuff) needs to have the path stripped
302302 debug ( 'trim prefix (%s) from url %s' , layerPath , req . url ) ;
303303 removed = layerPath ;
304- req . url = protohost + req . url . substr ( protohost . length + removed . length ) ;
304+ req . url = protohost + req . url . slice ( protohost . length + removed . length )
305305
306306 // Ensure leading slash
307307 if ( ! protohost && req . url [ 0 ] !== '/' ) {
@@ -547,10 +547,10 @@ function getProtohost(url) {
547547 var pathLength = searchIndex !== - 1
548548 ? searchIndex
549549 : url . length
550- var fqdnIndex = url . substr ( 0 , pathLength ) . indexOf ( '://' )
550+ var fqdnIndex = url . slice ( 0 , pathLength ) . indexOf ( '://' )
551551
552552 return fqdnIndex !== - 1
553- ? url . substr ( 0 , url . indexOf ( '/' , 3 + fqdnIndex ) )
553+ ? url . substring ( 0 , url . indexOf ( '/' , 3 + fqdnIndex ) )
554554 : undefined
555555}
556556
0 commit comments