datum-focus
Version:
Data shape, model, metadata, JSON, JSON Schema, GraphQL, MongoDB query and aggregations, iterator generators
16 lines (13 loc) • 398 B
text/typescript
const WORDS = require("../../../../data/common-english.json").data;
// const WORDS = ["et", "sum", "ti", "si", "se", "ni", "ne", "te"];
export function words(count: number) {
const arr: any[] = [];
for (let i = 0; i < count; i++) {
arr.push(word());
}
return arr;
}
export default function word() {
const idx = Math.floor(Math.random() * (WORDS.length - 1));
return WORDS[idx];
}