Skip to content
Myr

lint: remove deprecated String.prototype.substr

Before adoption: this commit came in with the history the project adopted, so no landing records it.

closes #4860

authored by Tobias Speicher · committed by Douglas Christopher Wilson · parent 446046f · Browse files · 2 files+9 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−9 removed

  • other:+9 added−9 removed

2 files+9 added−9 removed

modified:lib/router/index.js+8 added-8 removed
106 unmodified lines
107 var len = params.length;108 var ret;109110 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 }114115 for (var i = 0; i < len; ++i) {116 if (ret = params[i](name, fn)) {
62 unmodified lines
179 : err;180181 // remove added slash182 if (slashAdded) {183 req.url = req.url.substr(1);183 req.url = req.url.slice(1)184 slashAdded = false;185 }186187 // restore altered req.url188 if (removed.length !== 0) {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 removed = '';192 }193194 // signal to exit router
92 unmodified lines
287288 function trim_prefix(layer, layerError, layerPath, path) {289 if (layerPath.length !== 0) {290 // Validate path is a prefix match291 if (layerPath !== path.substr(0, layerPath.length)) {291 if (layerPath !== path.slice(0, layerPath.length)) {292 next(layerError)293 return294 }295
4 unmodified lines
300 // Trim off the part of the url that matches the route301 // middleware (.use stuff) needs to have the path stripped302 debug('trim prefix (%s) from url %s', layerPath, req.url);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)305306 // Ensure leading slash307 if (!protohost && req.url[0] !== '/') {308 req.url = '/' + req.url;
237 unmodified lines
546 var searchIndex = url.indexOf('?')547 var pathLength = searchIndex !== -1548 ? searchIndex549 : url.length550 var fqdnIndex = url.substr(0, pathLength).indexOf('://')550 var fqdnIndex = url.slice(0, pathLength).indexOf('://')551552 return fqdnIndex !== -1553 ? url.substr(0, url.indexOf('/', 3 + fqdnIndex))553 ? url.substring(0, url.indexOf('/', 3 + fqdnIndex))554 : undefined555}556557// get type for error message
111 unmodified lines
modified:lib/view.js+1 added-1 removed