node-postal icon indicating copy to clipboard operation
node-postal copied to clipboard

Expose options like in pypostal

Open jefffriesen opened this issue 7 years ago • 2 comments

pypostal has all of these options available: https://github.com/openvenues/pypostal/blob/master/postal/expand.py#L17-L51

node-postal has direct-to-c sorcery: expand: require('bindings')('expand'). It looks like you can't pass options in (and I couldn't by trial and error).

Is there a way to expose options for the node binding? Or if you can use them, how?

Thanks

jefffriesen avatar Aug 27 '17 16:08 jefffriesen

The options are exposed in node-postal (not really documented though) and can be passed in as a second argument in a JS object:

var postal = require('node-postal');
postal.expand.expand_address('Pine St', {'address_components': postal.expand.ADDRESS_STREET});

The source for node-postal expand is mostly C/C++, options can be found here: https://github.com/openvenues/node-postal/blob/master/src/expand.cc#L61-L98

albarrentine avatar Aug 27 '17 19:08 albarrentine

transliterate option doesn't seem to affect the results: setting it to false doesn't prevent transliterated results from appearing.

serge-medvedev avatar Oct 20 '23 10:10 serge-medvedev