GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — url,tools,benchmark: replace deprecated `substr()` · nodejs/node@ef6a210

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .eslintrc.js
  • benchmark/http
    • bench-parser.js
  • lib
    • url.js
  • tools/doc
    • html.mjs
    • json.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.eslintrc.js‎

Copy file name to clipboardExpand all lines: .eslintrc.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ module.exports = {
212212
selector: 'ThrowStatement > CallExpression[callee.name=/Error$/]',
213213
message: 'Use `new` keyword when throwing an `Error`.',
214214
},
215+
{
216+
selector: "CallExpression[callee.property.name='substr']",
217+
message: 'Use String.prototype.slice() or String.prototype.substring() instead of String.prototype.substr()',
218+
},
215219
{
216220
selector: "CallExpression[callee.name='isNaN']",
217221
message: 'Use Number.isNaN() instead of the global isNaN() function.',
Collapse file

‎benchmark/http/bench-parser.js‎

Copy file name to clipboardExpand all lines: benchmark/http/bench-parser.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function main({ len, n }) {
4646
let header = `GET /hello HTTP/1.1${CRLF}Content-Type: text/plain${CRLF}`;
4747

4848
for (let i = 0; i < len; i++) {
49-
header += `X-Filler${i}: ${Math.random().toString(36).substr(2)}${CRLF}`;
49+
header += `X-Filler${i}: ${Math.random().toString(36).substring(2)}${CRLF}`;
5050
}
5151
header += CRLF;
5252

Collapse file

‎lib/url.js‎

Copy file name to clipboardExpand all lines: lib/url.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
958958
srcPath.unshift('');
959959
}
960960

961-
if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
961+
if (hasTrailingSlash && (srcPath.join('/').slice(-1) !== '/')) {
962962
srcPath.push('');
963963
}
964964

Collapse file

‎tools/doc/html.mjs‎

Copy file name to clipboardExpand all lines: tools/doc/html.mjs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,8 @@ function versionSort(a, b) {
394394
b = minVersion(b).trim();
395395
let i = 0; // Common prefix length.
396396
while (i < a.length && i < b.length && a[i] === b[i]) i++;
397-
a = a.substr(i);
398-
b = b.substr(i);
397+
a = a.substring(i);
398+
b = b.substring(i);
399399
return +b.match(numberRe)[0] - +a.match(numberRe)[0];
400400
}
401401

Collapse file

‎tools/doc/json.mjs‎

Copy file name to clipboardExpand all lines: tools/doc/json.mjs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ function parseSignature(text, sig) {
320320

321321
const eq = sigParam.indexOf('=');
322322
if (eq !== -1) {
323-
defaultValue = sigParam.substr(eq + 1);
324-
sigParam = sigParam.substr(0, eq);
323+
defaultValue = sigParam.substring(eq + 1);
324+
sigParam = sigParam.substring(0, eq);
325325
}
326326

327327
// At this point, the name should match. If it doesn't find one that does.

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.