Skip to content

Commit

Permalink
feat: add static list methods
Browse files Browse the repository at this point in the history
  • Loading branch information
pnodet committed Sep 24, 2024
1 parent 04a37ff commit 94ad1f6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/arrays/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ export class List<T> extends Array<T> {
return new List(...arr);
}

static fromIterable<S>(iterable: Iterable<S>): List<S> {
return new List(...iterable);
}

static toArray<S>(list: List<S>): S[] {
return list;
}

toArray(): T[] {
return this;
}

append(item: T): this {
this.push(item);

Expand Down

0 comments on commit 94ad1f6

Please sign in to comment.