Skip to content

Commit 19d61fc

Browse files
committed
url: replaced slice with at
1 parent 5fe16bc commit 19d61fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/url.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
919919
// If a url ENDs in . or .., then it must get a trailing slash.
920920
// however, if it ends in anything else non-slashy,
921921
// then it must NOT get a trailing slash.
922-
let last = srcPath.slice(-1)[0];
922+
let last = srcPath.at(-1);
923923
const hasTrailingSlash = (
924924
((result.host || relative.host || srcPath.length > 1) &&
925925
(last === '.' || last === '..')) || last === '');
@@ -952,7 +952,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
952952
srcPath.unshift('');
953953
}
954954

955-
if (hasTrailingSlash && (srcPath.join('/').slice(-1) !== '/')) {
955+
if (hasTrailingSlash && (srcPath.join('/').at(-1) !== '/')) {
956956
srcPath.push('');
957957
}
958958

0 commit comments

Comments
 (0)