An open API service indexing awesome lists of open source software.

https://github.com/ehmpathy/domain-glossary-postcode

a glossary of intuitive, universally unambiguous postcode definitions and procedures
https://github.com/ehmpathy/domain-glossary-postcode

Last synced: 4 months ago
JSON representation

a glossary of intuitive, universally unambiguous postcode definitions and procedures

Awesome Lists containing this project

README

          

# domain-glossary-postcode

![test](https://github.com/ehmpathy/domain-glossary-postcode/workflows/test/badge.svg)
![publish](https://github.com/ehmpathy/domain-glossary-postcode/workflows/publish/badge.svg)

A glossary of intuitive, universally unambiguous postcode definitions and procedures.

# purpose

enable static-type checks for postcodes
- `Postcode` = `AsOfGlossary`
- `isPostcode`

declare useful procedures to operate on postcodes
- e.g., `getCentroidOfPostcode`

# install

```sh
npm install domain-glossary-postcode
```

# use

## Postcode

### declare that a given variable is a postcode

```ts
const postcode: Postcode;
```

### assure that a given string is a postcode

```ts
const postcode: Postcode = isPostcode.assure('33127');
```

### get the geocode of a postcode

```ts
const centroid: Geocode = getCentroidOfPostcode('33127')
```