diff options
author | CommanderRoot <CommanderRoot@users.noreply.github.com> | 2022-04-04 21:08:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-04 21:08:43 +0300 |
commit | e3da5df4152fbe547f7871547165328e1bf06262 (patch) | |
tree | 273fd46ffb39ca4499af4a5b6a8807ba2b32b382 /workspaces/arborist/lib | |
parent | 44108f7be5e1e928d8aa3eda3c5c177bcd216c99 (diff) |
fix: replace deprecated String.prototype.substr() (#4667)
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
Diffstat (limited to 'workspaces/arborist/lib')
-rw-r--r-- | workspaces/arborist/lib/retire-path.js | 2 | ||||
-rw-r--r-- | workspaces/arborist/lib/shrinkwrap.js | 4 | ||||
-rw-r--r-- | workspaces/arborist/lib/version-from-tgz.js | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/workspaces/arborist/lib/retire-path.js b/workspaces/arborist/lib/retire-path.js index 5d583b151..0c7a4a319 100644 --- a/workspaces/arborist/lib/retire-path.js +++ b/workspaces/arborist/lib/retire-path.js @@ -7,7 +7,7 @@ const pathSafeHash = s => .update(s) .digest('base64') .replace(/[^a-zA-Z0-9]+/g, '') - .substr(0, 8) + .slice(0, 8) const retirePath = from => { const d = dirname(from) diff --git a/workspaces/arborist/lib/shrinkwrap.js b/workspaces/arborist/lib/shrinkwrap.js index ead9aed36..ab6c91935 100644 --- a/workspaces/arborist/lib/shrinkwrap.js +++ b/workspaces/arborist/lib/shrinkwrap.js @@ -807,7 +807,7 @@ class Shrinkwrap { const pathFixed = !resolved ? null : !/^file:/.test(resolved) ? resolved // resolve onto the metadata path - : `file:${resolve(this.path, resolved.substr(5))}` + : `file:${resolve(this.path, resolved.slice(5))}` // if we have one, only set the other if it matches // otherwise it could be for a completely different thing. @@ -1056,7 +1056,7 @@ class Shrinkwrap { // turn absolute file: paths into relative paths from the node // this especially shows up with workspace edges when the root // node is also a workspace in the set. - const p = resolve(node.realpath, spec.substr('file:'.length)) + const p = resolve(node.realpath, spec.slice('file:'.length)) set[k] = `file:${relpath(node.realpath, p)}` } else { set[k] = spec diff --git a/workspaces/arborist/lib/version-from-tgz.js b/workspaces/arborist/lib/version-from-tgz.js index cdb59b7d4..be4405cee 100644 --- a/workspaces/arborist/lib/version-from-tgz.js +++ b/workspaces/arborist/lib/version-from-tgz.js @@ -16,7 +16,7 @@ module.exports = (name, tgz) => { // basename checking. Note that registries can // be mounted below the root url, so /a/b/-/x/y/foo/-/foo-1.2.3.tgz // is a potential option. - const tfsplit = u.path.substr(1).split('/-/') + const tfsplit = u.path.slice(1).split('/-/') if (tfsplit.length > 1) { const afterTF = tfsplit.pop() if (afterTF === base) { |