Skip to content

Commit a0690ab

Browse files
authored
Merge pull request #135 from ak4zh/no-array-prototype-at
remove use of Array.prototype.at
2 parents 8301819 + 90c2742 commit a0690ab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib/entity.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export async function traversePathAsync<T extends object>(
9191
let parent = obj;
9292

9393
while (path.length < realPath.length) {
94-
const key = path.at(-1) as keyof typeof parent;
94+
const key = path[path.length - 1] as keyof typeof parent;
9595

9696
const value = modifier
9797
? await modifier({
@@ -110,7 +110,7 @@ export async function traversePathAsync<T extends object>(
110110
path.push(realPath[path.length]);
111111
}
112112

113-
const key = realPath.at(-1);
113+
const key = realPath[realPath.length - 1];
114114

115115
return {
116116
parent,
@@ -145,7 +145,7 @@ export function traversePath<T extends object>(
145145
let parent = obj;
146146

147147
while (path.length < realPath.length) {
148-
const key = path.at(-1) as keyof typeof parent;
148+
const key = path[path.length - 1] as keyof typeof parent;
149149

150150
const value = modifier
151151
? modifier({
@@ -164,7 +164,7 @@ export function traversePath<T extends object>(
164164
path.push(realPath[path.length]);
165165
}
166166

167-
const key = realPath.at(-1);
167+
const key = realPath[realPath.length - 1];
168168
return {
169169
parent,
170170
key: String(key),

0 commit comments

Comments
 (0)