nichtich/wikidata-taxonomy

refactor as node module to be used in other projects

nichtich opened this issue · 3 comments

The command line script should be a wrapper to a module

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.

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

  1. what format is options?
  2. does the above line return a promise?

Thanks for asking. I extended the documentation.