diff --git a/lib/file.js b/lib/file.js index 24e140779..2342fd3ab 100644 --- a/lib/file.js +++ b/lib/file.js @@ -36,7 +36,7 @@ class File { * @returns {string} detected file type or empty string */ detectType () { - return path.extname(this.path).substring(1) + return path.extname(this.path).slice(1) } toString () { diff --git a/lib/helper.js b/lib/helper.js index 3c58fe8dc..9be119378 100644 --- a/lib/helper.js +++ b/lib/helper.js @@ -30,15 +30,15 @@ const parser = (pattern, out) => { t = 'optional' } out[t]++ - return parser(pattern.substring(1), out) + return parser(pattern.slice(1), out) } if (matches[2] !== undefined) { out.ext_glob++ parser(matches[2], out) - return parser(pattern.substring(matches[0].length), out) + return parser(pattern.slice(matches[0].length), out) } out.range++ - return parser(pattern.substring(matches[0].length), out) + return parser(pattern.slice(matches[0].length), out) } const gsParser = (pattern, out) => { diff --git a/lib/launchers/process.js b/lib/launchers/process.js index a7aa101ce..9fa859fc3 100644 --- a/lib/launchers/process.js +++ b/lib/launchers/process.js @@ -44,7 +44,7 @@ function ProcessLauncher (spawn, tempDir, timer, processKillTimeout) { // Normalize the command, remove quotes (spawn does not like them). this._normalizeCommand = function (cmd) { if (cmd.charAt(0) === cmd.charAt(cmd.length - 1) && '\'`"'.includes(cmd.charAt(0))) { - cmd = cmd.substring(1, cmd.length - 1) + cmd = cmd.slice(1, -1) log.warn(`The path should not be quoted.\n Normalized the path to ${cmd}`) } diff --git a/lib/url.js b/lib/url.js index 0bbfcc6d3..ebe078619 100644 --- a/lib/url.js +++ b/lib/url.js @@ -19,7 +19,7 @@ class Url { * @returns {string} detected file type or empty string */ detectType () { - return path.extname(new URL(this.path).pathname).substring(1) + return path.extname(new URL(this.path).pathname).slice(1) } toString () {