Skip to content

Commit

Permalink
replaced substr with substring
Browse files Browse the repository at this point in the history
  • Loading branch information
k-rajat19 committed Feb 16, 2022
1 parent 90f4449 commit aabe33c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion npm/publish-wiki.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = function (exit) {
sidebar = source.replace(/<a name="Collection"><\/a>[\s\S]+/g, '');

// remove sidebar data from home
home = source.substr(sidebar.length);
home = source.substring(sidebar.length);

// add timestamp to sidebar
sidebar += '\n\n ' + (new Date()).toUTCString();
Expand Down
2 changes: 1 addition & 1 deletion npm/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function createRedirectServer () {
}
// path: /status/<responseCode>
else if ((/^\/status\/(\d{3})$/).test(req.url)) {
res.writeHead(parseInt(req.url.substr(-3), 10), { location: '/' });
res.writeHead(parseInt(req.url.substring(req.url.length - 3), 10), { location: '/' });

return res.end();
}
Expand Down
2 changes: 1 addition & 1 deletion npm/test-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function (exit) {
var _exec = global.exec; // need to restore it later

files.filter(function (file) {
return (file.substr(-8) === '.test.js');
return (file.substring(file.length - 8) === '.test.js');
}).forEach(function (file) {
mocha.addFile(file);
});
Expand Down
2 changes: 1 addition & 1 deletion npm/test-library.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = function (exit) {
}

files.filter(function (file) {
return (file.substr(-8) === '.test.js');
return (file.substring(file.length - 8) === '.test.js');
}).forEach(function (file) {
mocha.addFile(file);
});
Expand Down
2 changes: 1 addition & 1 deletion npm/test-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = function (exit) {
}

files.filter(function (file) {
return (file.substr(-8) === '.test.js');
return (file.substring(file.length - 8) === '.test.js');
}).forEach(function (file) {
mocha.addFile(file);
});
Expand Down
2 changes: 1 addition & 1 deletion npm/test-unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function (exit) {
var mocha = new Mocha({ timeout: 1000 * 60 });

files.filter(function (file) { // extract all test files
return (file.substr(-8) === '.test.js');
return (file.substring(file.length - 8) === '.test.js');
}).forEach(mocha.addFile.bind(mocha));

// start the mocha run
Expand Down

0 comments on commit aabe33c

Please sign in to comment.