onemap-address-search-singapore

Search Singapore addresses by postal code using OneMAP API

Usage no npm install needed!

<script type="module">
  import onemapAddressSearchSingapore from 'https://cdn.skypack.dev/onemap-address-search-singapore';
</script>

README

onemap-address-search-singapore

Helper library to get Singapore address by postal code using OneMap API (https://docs.onemap.sg/)

Installation

# using npm
npm install onemap-address-search-singapore

# using yarn
yarn add onemap-address-search-singapore

Usage

# using require
const { getAddress } = require('onemap-address-search-singapore');

# using import
import { getAddress } from 'onemap-address-search-singapore';

Example

Using promises:

getAddress({
  postalCode: '178897' // provide Singapore postal code
}).then((address) => console.log(address));

Using async/await:

const getAddress = async function () {
  const address = await getAddress({
    postalCode: '178897' // provide Singapore postal code
  });
  console.log(address);
};

getAddress();