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
Provenance
- Commit
490f1a1- Tree
986f95a- Author
Tobias Speicher <rootcommander@gmail.com>- Committer
Douglas Christopher Wilson <doug@somethingdoug.com>- Parent
446046f
2 files changed+9 added−9 removed
modified:lib/router/index.js+8 added-8 removed
106 unmodified lines107 var len = params.length;108 var ret;109 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 }114 115 for (var i = 0; i < len; ++i) {116 if (ret = params[i](name, fn)) {62 unmodified lines179 : err;180 181 // remove added slash182 if (slashAdded) {183- req.url = req.url.substr(1);183+ req.url = req.url.slice(1)184 slashAdded = false;185 }186 187 // 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 }193 194 // signal to exit router92 unmodified lines287 288 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 lines300 // 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)305 306 // Ensure leading slash307 if (!protohost && req.url[0] !== '/') {308 req.url = '/' + req.url;237 unmodified lines546 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('://')551 552 return fqdnIndex !== -1553- ? url.substr(0, url.indexOf('/', 3 + fqdnIndex))553+ ? url.substring(0, url.indexOf('/', 3 + fqdnIndex))554 : undefined555 }556 557 // get type for error message111 unmodified linesmodified:lib/view.js+1 added-1 removed
72 unmodified lines73747576777778798081101 unmodified linesExpand all72 unmodified lines }
if (!opts.engines[this.ext]) { // load engine var mod = this.ext.substr(1) var mod = this.ext.slice(1) debug('require "%s"', mod)
// default engine export var fn = require(mod).__express101 unmodified linesExpand all