-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
26 lines (22 loc) · 692 Bytes
/
Copy pathexample.js
File metadata and controls
26 lines (22 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* eslint-disable no-console */
import { CategoryLoader, MwSources } from './index.js'
const loader = CategoryLoader.createFromTemplate(MwSources.wiktionary, 'en')
// const loader = CategoryLoader.createFromUrl('https://en.wikipedia.org/w/api.php')
/**
* @return {void}
*/
async function printSpanishGivenNames() {
try {
const members = await loader.loadMembers('Category:Spanish_given_names')
members.filter(
(member) => !member.title.startsWith('Category:')
).forEach(
(member) => {
console.log(`${member.title} (${member.id})`)
}
)
} catch (error) {
console.log('error: could not load members', error)
}
}
printSpanishGivenNames()