Skip to content

Commit

Permalink
refactor: {key,keyAt}(): reorder index check
Browse files Browse the repository at this point in the history
  • Loading branch information
Renegade334 committed Nov 4, 2024
1 parent a0722aa commit 4727aad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/collection/src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ export class Collection<Key, Value> extends Map<Key, Value> {
if (index >= 0) {
if (index >= this.size) return undefined;
} else {
if (index < this.size * -1) return undefined;
index += this.size;
if (index < 0) return undefined;
}

const iter = this.values();
Expand All @@ -191,8 +191,8 @@ export class Collection<Key, Value> extends Map<Key, Value> {
if (index >= 0) {
if (index >= this.size) return undefined;
} else {
if (index < this.size * -1) return undefined;
index += this.size;
if (index < 0) return undefined;
}

const iter = this.keys();
Expand Down

0 comments on commit 4727aad

Please sign in to comment.