word-vault
Version:
A lightweight JavaScript package for English word definitions and collections.
17 lines (16 loc) • 656 B
JavaScript
import { getAllCollections } from "./getAllCollections.js";
import { getPublishedCollections } from "./getCollectionsByStatus.js";
export function getTotalCardsAcrossCollections() {
const allCollections = getAllCollections();
if (!allCollections) {
return null;
}
return allCollections.reduce((total, collection) => total + collection.totalCards, 0);
}
export function getTotalCardsAcrossPublishedCollections() {
const publishedCollections = getPublishedCollections();
if (!publishedCollections) {
return null;
}
return publishedCollections.reduce((total, collection) => total + collection.totalCards, 0);
}