Skip to content

Commit 3b5b904

Browse files
committed
add test
1 parent d61457c commit 3b5b904

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
let toys = $state([]);
2+
3+
export function getUniqueToys() {
4+
let names = new Set();
5+
let uniqueToys = [];
6+
for (const toy in toys) {
7+
if (!names.has(toy.name)) {
8+
uniqueToys.push(toy);
9+
}
10+
}
11+
return uniqueToys;
12+
}
13+
14+
let uniqueToys = $derived.by(getUniqueToys);
15+
16+
console.log(uniqueToys)

0 commit comments

Comments
 (0)