word-vault
Version:
A lightweight JavaScript package for English word definitions and collections.
17 lines (16 loc) • 476 B
JavaScript
import { findCollection } from "./findCollection.js";
export function getCollectionCards(collectionSlug) {
const collection = findCollection(collectionSlug);
if (!collection) {
return null;
}
const words = new Set();
for (const category of collection.categories) {
for (const lesson of category.cards) {
for (const word of lesson) {
words.add(word);
}
}
}
return Array.from(words);
}