refactor as node module to be used in other projects
nichtich opened this issue · 3 comments
nichtich commented
The command line script should be a wrapper to a module
nichtich commented
Partly implemented in 0.2.6 but needs a stable JSON format before documentation or thoughts about how to use promises. There should be a simple function to be exported:
var wdtaxonomy = require('wikidata-taxonomy').taxonomy
var serialize = require('wikidata-taxonomy').serialize
var taxonomy = wdtaxonomy('Q123', options)
process.stdout.write(serialize(taxonomy, format))
This should better be documented.
kevincfz commented
Can you give some examples to use queryTaxonomy as a module?
In README you said
const { queryTaxonomy } = require('wikidata-taxonomy');
Is the following correct to use it?
queryTaxonomy('Q123', options)
If so, a few questions
- what format is options?
- does the above line return a promise?
nichtich commented
Thanks for asking. I extended the documentation.