Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

node-postcodes.io

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Issues
File Explorer

Advanced tools

node-postcodes.io

Postcodes.io - NodeJS Client/Wrapper

    1.0.3latest

Version published
Maintainers
1
Yearly downloads
6,216
increased by5.34%

Weekly downloads

Readme

Source

Postcodes.io - NodeJS Client/Wrapper

JavaScript Style Guide NPM Build Status

An easy to use postcodes.io wrapper for NodeJS.

:arrow_forward: Install

Install the package with npm:

$ npm i node-postcodes.io

:clipboard: Usage

const postcodes = require('node-postcodes.io')

Lookup

http://postcodes.io/docs#Postcode-Lookup

// single let result = await postcodes.lookup('PO123AA') // batch let result = await postcodes.lookup(['PO123AA', 'PO123AB']) // batch (with filter) let result = await postcodes.lookup(['PO123AA', 'PO123AB'], { filter: 'postcode,longitude,latitude' })

Geo

http://postcodes.io/docs#Geocode-Postcode

Single

// let result = await postcodes.geo(51.7923246977375, 0.629834723775309) // with optional params let result = await postcodes.geo(51.7923246977375, 0.629834723775309, { limit: 10, radius: 10, wideSearch: false })

Batch

// let result = await postcodes.geo([ { "longitude": 0.629834723775309, "latitude": 51.7923246977375, "radius": 1000, "limit": 5 },{ "longitude": -2.49690382054704, "latitude": 53.5351312861402, "radius": 1000, "limit": 5 } ]) // with optional params let result = await postcodes.geo([ { "longitude": 0.629834723775309, "latitude": 51.7923246977375, "radius": 1000, "limit": 5 },{ "longitude": -2.49690382054704, "latitude": 53.5351312861402, "radius": 1000, "limit": 5 } ], { filter: 'postcode,longitude,latitude', wideSearch: false })

Random

http://postcodes.io/docs#Geocode-Postcode

let result = await postcodes.random()

Validate

http://postcodes.io/docs#Postcode-Validation

let result = await postcodes.validate('PO123AA')

Nearest

http://postcodes.io/docs#Nearest-Postcode

let result = await postcodes.nearest('PO123AA') // with optional params let result = await postcodes.nearest('PO123AA', { radius: 1000, limit: 5 })

Autocomplete

http://postcodes.io/docs#Postcode-Autocomplete

let result = await postcodes.autocomplete('PO123AA') // with optional params let result = await postcodes.autocomplete('PO123AA', { limit: 5 })

Query

http://postcodes.io/docs#Postcode-Query

let result = await postcodes.query('PO123AA') // with optional params let result = await postcodes.query('PO123AA', { limit: 5 })

Terminated

http://postcodes.io/docs#Terminated

let result = await postcodes.terminated('PO123AA')

Outcodes

http://postcodes.io/docs#Show-Outcode

// lookup let result = await postcodes.outcodes('PO33') // nearest let result = await postcodes.outcodes('PO3', { limit: 10, radius: 10 }) // nearest (lat, lng) let result = await postcodes.outcodes(51.7923246977375, 0.629834723775309) // with optional params let result = await postcodes.outcodes(51.7923246977375, 0.629834723775309, { limit: 10, radius: 10 })

Places

http://postcodes.io/docs#Place-Lookup

// lookup let result = await postcodes.places('osgb4000000074553605') // query let result = await postcodes.places('Ryde', { limit: 10 }) // random let result = await postcodes.places()

:lock: Testing

Can see test results @ https://travis-ci.org/lcherone/node-postcodes.io, if you want to run them locally, your need install mocha, then run:

$ npm test

The MIT License (MIT). Please see License File for more information.

Keywords

Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc