@@ -108,8 +108,8 @@ proto.param = function param(name, fn) {
108
108
var ret ;
109
109
110
110
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 )
113
113
}
114
114
115
115
for ( var i = 0 ; i < len ; ++ i ) {
@@ -180,14 +180,14 @@ proto.handle = function handle(req, res, out) {
180
180
181
181
// remove added slash
182
182
if ( slashAdded ) {
183
- req . url = req . url . substr ( 1 ) ;
183
+ req . url = req . url . slice ( 1 )
184
184
slashAdded = false ;
185
185
}
186
186
187
187
// restore altered req.url
188
188
if ( removed . length !== 0 ) {
189
189
req . baseUrl = parentUrl ;
190
- req . url = protohost + removed + req . url . substr ( protohost . length ) ;
190
+ req . url = protohost + removed + req . url . slice ( protohost . length )
191
191
removed = '' ;
192
192
}
193
193
@@ -288,7 +288,7 @@ proto.handle = function handle(req, res, out) {
288
288
function trim_prefix ( layer , layerError , layerPath , path ) {
289
289
if ( layerPath . length !== 0 ) {
290
290
// Validate path is a prefix match
291
- if ( layerPath !== path . substr ( 0 , layerPath . length ) ) {
291
+ if ( layerPath !== path . slice ( 0 , layerPath . length ) ) {
292
292
next ( layerError )
293
293
return
294
294
}
@@ -301,7 +301,7 @@ proto.handle = function handle(req, res, out) {
301
301
// middleware (.use stuff) needs to have the path stripped
302
302
debug ( 'trim prefix (%s) from url %s' , layerPath , req . url ) ;
303
303
removed = layerPath ;
304
- req . url = protohost + req . url . substr ( protohost . length + removed . length ) ;
304
+ req . url = protohost + req . url . slice ( protohost . length + removed . length )
305
305
306
306
// Ensure leading slash
307
307
if ( ! protohost && req . url [ 0 ] !== '/' ) {
@@ -547,10 +547,10 @@ function getProtohost(url) {
547
547
var pathLength = searchIndex !== - 1
548
548
? searchIndex
549
549
: url . length
550
- var fqdnIndex = url . substr ( 0 , pathLength ) . indexOf ( '://' )
550
+ var fqdnIndex = url . slice ( 0 , pathLength ) . indexOf ( '://' )
551
551
552
552
return fqdnIndex !== - 1
553
- ? url . substr ( 0 , url . indexOf ( '/' , 3 + fqdnIndex ) )
553
+ ? url . substring ( 0 , url . indexOf ( '/' , 3 + fqdnIndex ) )
554
554
: undefined
555
555
}
556
556
0 commit comments