Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulelhakim68@gmail.com committed Jan 23, 2024
1 parent e963da8 commit 9a95d28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export class List<T> implements AbstractList<T extends any ? T : never> {
: never)
| undefined,
): boolean | (T extends any ? T : never) | undefined {
// if ``after`` argument given, doing some computation befoere inserting.
if (after) {
const foundAfter = this.find((el) => this.isEquals(el, after as T));
const afterId = this._context.indexOf(foundAfter as T);
Expand All @@ -160,9 +161,8 @@ export class List<T> implements AbstractList<T extends any ? T : never> {
return true;
}

// // if after element is not pases otherwise append them at the last
// other wise just append that element at the end of list and check again that record is found then return as booleans
this.append(element);
// // check again that record is fond and return as booleans
const aftterInsert = this.find((e) => this.isEquals(e, element));
return !!aftterInsert;
}
Expand Down

0 comments on commit 9a95d28

Please sign in to comment.