Async NAPI based interface for libpostal
$ npm install --save postal-async
const { parse, expand } = require('postal-async');
expand('781 Franklin Ave Crown Hts Brooklyn NY', function(err, expansions) {
// expansion is an array of expanded addresses
assert(expansions.includes('781 franklin avenue crown heights brooklyn new york'));
});
parse('781 Franklin Ave Crown Hts Brooklyn NY', function(err, parsed) {
// parsed is an object with house_number, street etc.
assert(parsed.find(({ value, label }) => label === 'house_number' && value === '781'));
});
MIT © Damian Krzeminski