Skip to content

Commit 415cf47

Browse files
committed
✨ Add mod.ts
1 parent 0e8e384 commit 415cf47

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

β€Žarray_to_list.tsβ€Ž

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ export interface List<T> {
22
value: T;
33
rest: List<T> | null;
44
}
5-
export function arrayToList<T>(values: T[]): List<T> {
6-
const [hey] = values;
7-
return { value: hey, rest: null };
5+
6+
// Recursivity FTW πŸš€πŸš€πŸš€
7+
export function arrayToList<T>([value, ...values]: T[]): List<T> | null {
8+
return value ? { value, rest: arrayToList(values) } : null;
89
}

β€Žmod.tsβ€Ž

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export * from "./array_to_list.ts";
2+
export * from "./bean_counting.ts";
3+
export * from "./minimum.ts";
4+
export * from "./is_even.ts";
5+
export * from "./range.ts";
6+
export * from "./reversing_array.ts";
7+
export * from "./sum.ts";

0 commit comments

Comments
Β (0)