Package Manager (npm)
Address Finder is also available without transpilation or minification on npm as @ideal-postcodes/address-finder
.
The address-finder
npm package works out-of-the-box with most bundlers. The advantage of consuming this package are:
- Finer control over which browsers you wish to support
- Dependency deduplification
- Tree shaking
- Smaller package sizes
@ideal-postcodes/address-finder-bundled
also works with bundlers. In fact, address-finder-bundled
is built from address-finder
using this rollup configuration. address-finder-bundled
will work in all bundlers with no configuration changes as it is conservatively pre-transpiled, polyfilled and minified.
Use address-finder-bundled
if you are having difficulty adding address-finder
to your bundler. The output may be slightly larger but it is guaranteed to work without changing your bundler configuration.
Install
Add
Add address-finder to your project via npm with
npm install @ideal-postcodes/address-finder
Instantiate
Instantiate Address Finder with AddressFinder.setup
.
import { AddressFinder } from "@ideal-postcodes/address-finder";
const controller = AddressFinder.setup({
apiKey: "ak_test",
outputFields: {
line_1: "#line_1",
line_2: "#line_2",
line_3: "#line_3",
post_town: "#post_town",
postcode: "#postcode",
},
});